Form.FormBorderStyle Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the border style of the form.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member FormBorderStyle : FormBorderStyle with get, set

Property Value

Type: System.Windows.Forms.FormBorderStyle

A 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.

System_CAPS_noteNote

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.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: