Control.ClientRectangle Property

 

Gets the rectangle that represents the client area of the control.

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

[<BrowsableAttribute(false)>]
member ClientRectangle : Rectangle with get

Property Value

Type: System.Drawing.Rectangle

A Rectangle that represents the client area of the control.

The client area of a control is the bounds of the control, minus the nonclient elements such as scroll bars, borders, title bars, and menus.

Because client coordinates are relative to the upper-left corner of the client area of the control, the coordinates of the upper-left corner of the rectangle returned by this property are (0,0). You can use this property to obtain the size and coordinates of the client area of the control for tasks such as drawing on the surface of the control.

For more information about drawing on controls, see Rendering a Windows Forms Control.

The following code example enables auto-scrolling for a form, resizes the form, and ensures that a button remains visible after the form is resized. This example requires that you have a Form with a Button named button2 on it.

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

.NET Framework
Available since 1.1
Return to top
Show: