Alex Rivera | Logout

Maximize a window programmatically and prevent the user from changing the windows state

Asked 2010-08-17T09:40:31.670
23

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.

Edit
Report

1 Answer

7

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;
answered 2010-08-17T10:03:42.670

Your Answer