For some reason if you set both of the width and the height of Form.MaximumSize to zero it will let you have an unrestricted window size, however if you want to set a limit you have to do it for both width and height at the same time. I want a fixed width but no limit on height.
// No Limits
this.MaximumSize = new Size(0,0);
// Form Height will be stuck at 0
int ArbitraryWidth = 200;
this.MaximumSize = new Size(ArbitraryWidth, 0);
Resize with the designerBy dragging either the right edge, bottom edge, or the corner, you can resize the form. The second way you can resize the form while the designer is open, is through the properties pane. Select the form, then find the Properties pane in Visual Studio. Scroll down to size and expand it.
Right click on your form and go to properties. Then go to Layout options,see there are a property named Size. Change it as your need as width and length wise. Also see a property named StartPosition just after the Size property.
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 INT_MAX since that's the theoretical limit that can be represented by a Size
anyway:
//Max width 200, unlimited height
this.MaximumSize = new Size(200, int.MaxValue);
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