How do I maximize a window programmatically so that it cannot be resized once it reaches the maximized state (for example, maximize Internet Explorer and see it)?
I set FormWindowState property as
this.WindowState = FormWindowState.Maximized;
this.MaximizedBounds = (x,y);
but it doesn't work. How do I do this?
The window I want to maximize is a window in my application.
When your form is maximized, set its minimum size = max size, so user cannot resize it.
this.WindowState = FormWindowState.Maximized;
this.MinimumSize = this.Size;
this.MaximumSize = this.Size;
You were close... after your code of
WindowState = FormWindowState.Maximized;
THEN, set the form's min/max size capacity to the value once its sized out.
MinimumSize = this.Size;
MaximumSize = this.Size;
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