Form Adornments


In addition to size and location, forms have a number of properties that manage various other aspects of their appearance as well as corresponding behavior. The following settings govern the non-client adornments of a form: those parts of a form outside the client area that are drawn by Windows .

  • FormBorderStyle sets whether the form has a border, whether it can be resized, and whether it has a normal-size or small caption. Good forms and dialogs leave the default value of Sizable . Annoying dialogs change this property to one of the nonsizable options. Generally, programmers choose nonsizable options because of fear of control-layout issues, but WinForms handles that nicely , as we discuss later in this chapter.

    In addition, there are two tool window styles ”one fixed and one sizable ”for use in building floating toolbar-style windows.

  • ControlBox is a Boolean determining whether or not the icon on the upper left of the form as well as the close button on the upper right are shown. If this property is set to false, neither left-clicking on the upper-left corner of the form nor right-clicking on the caption will show the System menu. Similarly, when ControlBox is false, the MaximizeBox and MinimizeBox properties will be ignored, and those buttons will not be shown. This property defaults to true but is often set to false for modal dialogs.

  • The MaximizeBox and MinimizeBox properties determine whether the maximize and minimize buttons are shown on the form's caption. These properties default to true but are often set to false for modal dialogs.

  • The HelpButton property shows the question mark button next to the close button in the upper right, but only if ControlBox is set to true and MaximizeBox and MinimizeBox are both set to false. This property defaults to false but is often set to true for modal dialogs. When the user clicks on the help button and then somewhere else on the form, the HelpRequested event is fired for the form to provide the user with help. Whether the HelpButton property is true or false, the HelpRequested event is always fired when the user presses F1.

  • The Icon property determines the image used as the icon for the form.

  • The SizeGripStyle property allows values from the SizeGripStyle enumeration: Auto, Hide, or Show. A size grip is the adornment on the lower-right corner of a window that indicates that it can be resized. The default is Auto and indicates showing the size grip in the lower-right corner "if needed," depending on the form's FormBorderStyle property. The Auto setting judges the size grip needed if the form is sizable and is shown modally. Also, if the form has a StatusBar control, the form's SizeGripStyle is ignored in favor of the SizingGrip Boolean property on the status bar control itself.

  • ShowInTaskbar is a Boolean governing whether the form's Text property should appear in a button on the shell taskbar. This property defaults to true but is often set to false for modal forms.

Although most of the properties are independent of each other, not all of these combinations will work together. For example, when the FormBorderStyle is set to either of the tool window settings, no maximize or minimize box is shown, regardless of the value of the MaximizeBox and MinimizeBox properties. Experimentation will reveal what works and what doesn't.



Windows Forms Programming in Visual Basic .NET
Windows Forms Programming in Visual Basic .NET
ISBN: 0321125193
EAN: 2147483647
Year: 2003
Pages: 139

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net