Form.FormBorderStyle Property
Gets or sets the border style of the form.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Property Value
Type: System.Windows.Forms.FormBorderStyleA FormBorderStyle that represents the style of border to display for the form. The default is FormBorderStyle.Sizable.
| Exception | Condition |
|---|---|
| InvalidEnumArgumentException | The value specified is outside the range of valid values. |
The border style of the form determines how the outer edge of the form appears. In addition to changing the border display for a form, certain border styles prevent the form from being sized. For example, the FormBorderStyle.FixedDialog border style changes the border of the form to that of a dialog box and prevents the form from being resized. The border style can also affect the size or availability of the caption bar section of a form.
Note |
|---|
With the Sizable style, it is impossible to resize the window below a certain minimum value, even if you have set ControlBox to false and assigned a zero-length string to Text. Consider working around this by using the SizableToolWindow style instead. |
The following code example creates a new instance of a Form and calls the ShowDialog method to display the form as a dialog box. The example sets the FormBorderStyle, AcceptButton, CancelButton, MinimizeBox, MaximizeBox, and StartPosition properties to change the appearance and functionality of the form to a dialog box. The example also uses the Add method of the form's Controls collection to add two Button controls. The example uses the HelpButton property to display a help button in the caption bar of the dialog box.
Available since 1.1
