G
Gerhard Menzl
I am developing a Windows Forms application that is supposed to stay
maximized and immovable all the time. Unfortunately, this approach:
WindowState = FormWindowState::Maximized;
MaximizeBox = false;
does not work. While the first statement does maximize the window, the
second one causes it to remain movable nevertheless. Leaving the
MaximizeBox property at its default value (true) achieves standard
Windows behaviour (a maximized window cannot be moved), but it allows
the user to restore the unmaximized size, which violates the specification.
Since I cannot remember having encountered this problem with the
original Windows API, I suspect it is a Windows Forms glitch, but I may
be wrong. Does anyone know a technique that achieves what I want and
does not involve overriding Move events or similar contortions?
A second problem I stumbled across is how to determine the client area
of the maximized window. Setting the WindowState property to maximized
does not change any of the size-related properties until the next Resize
event, no matter how often you call ResumeLayout or Refresh. Is
postponing operations that depend on the maximized size the only option,
or is there a way to determine the maximized window size right away?
maximized and immovable all the time. Unfortunately, this approach:
WindowState = FormWindowState::Maximized;
MaximizeBox = false;
does not work. While the first statement does maximize the window, the
second one causes it to remain movable nevertheless. Leaving the
MaximizeBox property at its default value (true) achieves standard
Windows behaviour (a maximized window cannot be moved), but it allows
the user to restore the unmaximized size, which violates the specification.
Since I cannot remember having encountered this problem with the
original Windows API, I suspect it is a Windows Forms glitch, but I may
be wrong. Does anyone know a technique that achieves what I want and
does not involve overriding Move events or similar contortions?
A second problem I stumbled across is how to determine the client area
of the maximized window. Setting the WindowState property to maximized
does not change any of the size-related properties until the next Resize
event, no matter how often you call ResumeLayout or Refresh. Is
postponing operations that depend on the maximized size the only option,
or is there a way to determine the maximized window size right away?