Files
docs-desktop/dotnet-desktop-guide/framework/winforms/how-to-change-the-borders-of-windows-forms.md
T
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

2.4 KiB

title, ms.date, dev_langs, helpviewer_keywords, ms.assetid
title ms.date dev_langs helpviewer_keywords ms.assetid
Change form borders 03/30/2017
csharp
vb
cpp
Windows Forms, changing the borders
b3d5fa56-80c6-4b10-b505-f9672307ed55

How to: Change the Borders of Windows Forms

You have several border styles to choose from when you are determining the appearance and behavior of your Windows Forms. By changing the xref:System.Windows.Forms.Form.FormBorderStyle%2A property, you can control the resizing behavior of the form. In addition, setting the xref:System.Windows.Forms.Form.FormBorderStyle%2A affects how the caption bar is displayed as well as what buttons might appear on it. For more information, see xref:System.Windows.Forms.FormBorderStyle.

There is extensive support for this task in Visual Studio.

See also How to: Change the Borders of Windows Forms Using the Designer.

To set the border style of Windows Forms programmatically

  • Set the xref:System.Windows.Forms.Form.FormBorderStyle%2A property to the style you want. The following code example sets the border style of form DlgBx1 to xref:System.Windows.Forms.FormBorderStyle.FixedDialog.

    DlgBx1.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog  
    
    DlgBx1.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;  
    
    DlgBx1->FormBorderStyle =  
       System::Windows::Forms::FormBorderStyle::FixedDialog;  
    

    Also see How to: Create Dialog Boxes at Design Time.

    Additionally, if you have chosen a border style for the form that provides optional Minimize and Maximize buttons, you can specify whether you want either or both of these buttons to be functional. These buttons are useful when you want to closely control the user experience. The Minimize and Maximize buttons are enabled by default, and their functionality is manipulated through the Properties window.

See also