24

On Windows 7 with the Aero theme, Notepad++'s Preferences window has square corners, no system menu icon, a close button, and a darker 1px border. This window also has an AlwaysOnTop attribute.

notepad++
(I resized the window to fit a width of 640px.)

Interestingly enough, you can copy this style to other windows using AutoHotkey. So, it would seem that there is no dirty tricks involved. However, I don't think I've seen this window style anywhere else.

Is using this style condemned by Microsoft? Does this type of window have a name?


For the curious: Normal vs "Square"

normal   calculator

2
  • I think (but am not sure) that the .NET framework will give a frame with rounded corners by default, and no-one really feels like changing it.
    – soandos
    Jun 14, 2012 at 3:25
  • Because Apple has a patent on rounded corners.
    – Chloe
    Feb 17, 2015 at 23:16

2 Answers 2

37

It's called a Tool(bar) Window. Any windows that have the WS_EX_TOOLWINDOW extended style will be rendered without a system menu or minimize/maximize boxes, and a small titlebar. In Windows XP and up (that support themes), tool windows are usually rendered without rounded corners (at least with the default themes).

This style is usually used for toolbars (Figure 1). You can see it by dragging a toolbar off of a program that lets you rearrange the toolbars. Notice that it becomes a window that looks like the one in question. Windows Explorer also uses it for deskbands (Figure 2) which are basically the same thing. You can see these by dragging a folder to one of the screen edges, then drag the resulting toolbar/deskband out to the desktop.

Obviously some programs use the style for other purposes, often as a way of creating a sort of modal, temporary dialog that is a child to the main program.

Note: this has a couple of effects (the first two of which are usually the reasons for its non-standard usage):

  • A window/dialog with this style does not get a button on the taskbar
  • It prevents Alt+Tabbing to the dialog
  • It also prevents the Alt+PrtScr from capturing just the dialog; the whole parent program window is captured.

Figure 1: MSPaint toolbar window

enter image description here

Figure 2: Windows Explorer deskband

enter image description here

1
  • Alt+PrintScreen captures just the dialog in Windows 7 with the Notepad++ Preferences dialog.
    – Bob
    Jun 14, 2012 at 10:29
17

This details the name of this window style and the options available in .NET; see @Synetech's excellent answer for the original purpose of this window style, the reasons it may be used for such a dialog box and the implementation in unmanaged Windows programs such as Notepad++.


The window has square corners and looks like that because one of the designers/programmers of Notepad++ decided to use a specific window style. Synetech details the advantages of that window style.

In .NET/Visual Studio, this is set in the FormBorderStyle property of the System.Windows.Forms.Form class. Specifically, it is the FixedToolWindow. The possible values are in the System.Windows.Forms.FormBorderStyle enumeration.

The ToolWindows in .NET with all values default work a little differently from a plain WS_EX_TOOLWINDOW in the Windows API, though they look the same. With testing, I have determined that they do appear on the taskbar and they do appear on the Alt+Tab task switcher unless the form property ShowInTaskbar is set to false. ShowInTaskbar affects visibility in both the taskbar and Alt+Tab for ToolWindows, but only taskbar for others.

Meanwhile, it is also possible to remove the icon/minimise/restore/maximise buttons from the more common window styles, though it does not seem to be possible to add them to ToolWindows. It is also possible to hide normal windows from the taskbar.

The only functional advantage WS_EX_TOOLWINDOW offers, as far as I can tell, is that the window does not appear in Alt+Tab.


I have included some screenshots comparing the .NET window styles. These are not directly used by Notepad++, nor other unmanaged programs, but are named by Microsoft, so...

Possible values of FormBorderStyle:

The first image is a screenshot of the running program with Aero enabled, the second is from the Visual Studio designer view (no Aero).
Click the images for the full size versions
Descriptions are taken from the MSDN article on the FormBorderStyle enumeration.

  • None

    No border.

Screenshot_Aero Screenshot_NonAero

  • FixedSingle

    A fixed, single-line border.

Screenshot_Aero Screenshot_NonAero

  • Fixed3D

    A fixed, three-dimensional border.

Screenshot_Aero Screenshot_NonAero

  • FixedDialog

    A thick, fixed dialog-style border.

Screenshot_Aero Screenshot_NonAero

  • Sizable (default)

    A resizable border.

Screenshot_Aero Screenshot_NonAero

  • FixedToolWindow

    A tool window border that is not resizable. A tool window does not appear in the taskbar or in the window that appears when the user presses ALT+TAB. Although forms that specify FixedToolWindow typically are not shown in the taskbar, you must also ensure that the ShowInTaskbar property is set to false, since its default value is true.

Screenshot_Aero Screenshot_NonAero

  • SizableToolWindow

    A resizable tool window border. A tool window does not appear in the taskbar or in the window that appears when the user presses ALT+TAB.

Screenshot_Aero Screenshot_NonAero

5
  • Yeah! that what we was talking about.
    – avirk
    Jun 14, 2012 at 4:05
  • It has nothing to do with managed/unmanaged or native/.NET code. It is simply a matter of how Windows styles windows with the WS_EX_TOOLWINDOW style. .NET simply aliases FixedToolWindow to WS_EX_TOOLWINDOW and SizableToolWindow to WS_EX_TOOLWINDOW|WS_THICKFRAME. No offence, but this answer doesn’t actually answer the question or explain the behavior asked, it is simply a list/resource of different window styles used in .NET.
    – Synetech
    Jun 14, 2012 at 7:33
  • @Synetech I am aware it has nothing to do with whether the code is managed or not, I just thought I would give the name .NET uses and the other options available, with screenshots of the differences. Does this type of window have a name? It does answer that much, at least from a .NET programmer's perspective. And explanation? Because the programmer felt like using it. You've listed possibly desired effects. That's about it. Whether it's recommended or condemned by MS, I have no idea. Personally, I think you've done an admirable job at explaining it.
    – Bob
    Jun 14, 2012 at 7:50
  • That's what edits are for.
    – Synetech
    Jun 14, 2012 at 16:48
  • What's that @Synetech?
    – Bob
    Jun 14, 2012 at 22:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .