To change the size of the Form in C #, you only need to add a statusstrip and change sizinggrip to true. In this way, the mouse displays a resize handle in the lower right corner of the form, you can adjust the size.
The form size can be adjusted, but the control will not be adjusted together. You need to add a resize event for the form, and then adjust the widget size in the event. The following describes a listview control named listfiles:
This. listfiles. width = This. Width-
This. listfiles. Margin. horizontal;
This. listfiles. Height =
This. statusmain. Location. Y-This. listfiles. Location. Y-
This. listfiles. Margin. bottom;
Listfiles uses the toolbar and the status bar. Therefore, you do not need to adjust the start position of listfiles. You only need to adjust the size of listfiles. Its width is the width of the form minus the horizontal space occupied by listfiles. Its height is the starting position of the status bar minus the starting position of the status bar and then the size of the white space at the bottom of the listfiles.
In this way, the widget size can also be adjusted. But there is another problem: Sometimes we do not want the form to be dragged very small, and the basic controls are not displayed, so we need to set the minimum size of the form. BelowCodeSet the minimum size of the form to 1/3 of the workspace.
This. minimumsize = new size (systeminformation. workingarea. width/3, systeminformation. workingarea. Height/3 );
Author: xugd, 2009.9.23