Form.ClientSize Property

Gets or sets the size of the client area of the form.

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

<LocalizableAttribute(True)> _
Public Property ClientSize As Size
Dim instance As Form
Dim value As Size

value = instance.ClientSize

instance.ClientSize = value
/** @property */
public Size get_ClientSize ()

/** @property */
public void set_ClientSize (Size value)

public function get ClientSize () : Size

public function set ClientSize (value : Size)

Property Value

A Size that represents the size of the form's client area.

The size of the client area of the form is the size of the form excluding the borders and the title bar. The client area of a form is the area within a form where controls can be placed. You can use this property to get the proper dimensions when performing graphics operations or when sizing and positioning controls on the form. To get the size of the entire form, use the Size property or use the individual properties Height and Width.

The following code example creates an event handler for the Resize event of a form. The event handler uses the ClientSize property of the form to make a Button control named button1 fill the entire client area of the form.

Private Sub MyForm_Resize(sender As Object, e As EventHandler)
    ' Set the size of button1 to the size of the client area of the form.
    button1.Size = Me.ClientSize
End Sub 'MyForm_Resize

private void MyForm_Resize(Object sender, EventHandler e)
    // Set the size of button1 to the size of the client area of the form.
} //MyForm_Resize

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0