As per title.
I am writing a program that all components can adjust size automatically by form's size.
When I using this.Width
and this.Height
properties, its return value is the width and height of whole form (red frame).
How to get the form's width and height of its inner area (green frame)?
Select the form, then find the Properties pane in Visual Studio. Scroll down to size and expand it. You can set the Width and Height manually.
Open Visual Studio and select "Windows Forms Application" from the list of available templates and name it "DynamicallyPositioningControls". Rename your form to "frmDynamicResizing" by setting its Name property and sets its Text property to "Dynamic Resizing Form".
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.
Remarks. This property enables you to set the starting position of the form when it is displayed at run time. The form's position can be specified manually by setting the Location property or use the default location specified by Windows.
Use this.ClientSize.Width
and this.ClientSize.Height
.
http://msdn.microsoft.com/en-us/library/9278sfx2(v=vs.110).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With