I use Visual Studio .NET to create a Windows-based application. The application includes a form named CForm. CForm contains 15 controls that enable users to set basic configuration options for the application. I design these controls to dynamically adjust when users resize CForm. The controls automatically update their size and position on the form as the form is resized. The initial siz开发者_如何学JAVAe of the form should be 650 x 700 pixels. If CForm is resized to be smaller then 500 x 600 pixels, the controls will not be displayed correctly. How I must ensure that users cannot resize CForm to be smaller than 500 x 600 pixels..?
As the other authors already mentioned you should use the MinimumSize. But this can not only be set on the form. In fact every control (including UserControls) has this property and so you can also set it on each Button, ListView, etc.
Also i hope that you used the Anchor and Dock properties.
Last but not least for advanced layouts you should also take a look into the TableLayoutPanel or the SplitContainer.
Set the MinimumSize property in the designer or add this code to the form constructor:
this.MinimumSize = new Size(500, 600);
use the MinimumSize property of the Form
精彩评论