Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to obtain form's inner width and height

Tags:

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)?

like image 863
ChiaHsien Avatar asked Aug 28 '14 02:08

ChiaHsien


People also ask

How do I change the form size?

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.

How do you make a form resizable in C#?

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".

What is client area of the 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.

Is used to set the position of form at run time view?

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.


1 Answers

Use this.ClientSize.Width and this.ClientSize.Height.

http://msdn.microsoft.com/en-us/library/9278sfx2(v=vs.110).aspx

like image 198
AJ Richardson Avatar answered Oct 20 '22 21:10

AJ Richardson