Using Winforms, is there a way to allow resize, but only to allow the window to be made taller? The ability to make it wider not only wouldn't be allow, but would also be pleasing to the user.
Additionally, the ability to set a minimum height, and also be pleasing to the user?
You can set the Form.MinimumSize and Form.MaximumSize properties in say the Forrm Load event:
this.MinimumSize = new Size(400, 0);
this.MaximumSize = new Size(400, Screen.PrimaryScreen.Bounds.Height);
Or you could simply handle the Form resize event:
private void Form1_Resize(object sender, EventArgs e)
{
this.Width = 400;
}
The first option is probably better as it avoids the flickering on resizing.
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