Forms can be resized at run time. For example, if a form displays a bitmap, you may want to resize the form whenever the user selects a new bitmap.
To resize a form programmatically
[Visual Basic] Form1.Size = New System.Drawing.Size(100, 100) [C#]
To change form width and height programmatically
[Visual Basic] Form1.Width = 300 [C#]
– or –
[Visual Basic] Form1.Size = New Size(300, Form1.Size.Height) [C#]
To change form size by increments
[Visual Basic] Form1.Width += 200 [C#]
Caution Always use the Height or Width property to change the size of a form, unless you're setting both at the same time. The following code will not change the form size. The Size property returns a Size structure containing a copy of the form's height and width, and the X member of this structure is incremented by 100 — however, the copied and incremented structure is then discarded.
[Visual Basic] Dim f As frmAbout = New frmAbout f.Size.X += 100 [C#]
Use the syntax displayed in the bullet point above to increment the form's width.
Introduction to Win Forms | Win Forms Creation | Resizing Controls on Win Forms | Displaying Modal and Modeless Forms |Creating Transparent Win Forms | Setting the Location of Win Forms | Dialog Boxes