Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to prevent my desktop application from being maximized. It should not become maximized by any means - by double clicking on title bar, or by clicking Windows + Up arrow on the keyboard, etc.
- I disable both the MaximizeBox and MinimizeBox.
- I also set the MaximumSize and MinimumSize for my WinForm
Still when I press Windows + Up arrow, my win form Shifts to top left of the screen, I mean it gets maximized.
So please tell me any way to prevent this thing happening...
Posted
Comments
Sergey Alexandrovich Kryukov 15-Nov-12 14:37pm    
Do you want to prevent Maximize/Minimize, or Resize as well?
--SA
HeinrichRichardSonButt 17-Nov-12 1:01am    
I wanna prevent maximize and resize...
Resize is pretty prevented but maximize is still goin on...

The window is shifting to the top left corner just like when you try to maximize a 16-bit dos based application on your 32-bit Windows OS...
It just goes to the top left corner and then denies any movement, like when you maximize any window...
I mean the size remains the same but all the other properties are same as when any normal window is maximized..
Is there ne way to resolve this problem...??

1 solution

you can set the maximum size to be the size you want it to be, then it shouldn't maximize past that.

You can also handle the size changed event and check there if the state is maximized, and if it is, change it back.
 
Share this answer
 
v2
Comments
HeinrichRichardSonButt 15-Nov-12 13:26pm    
But the window is shifting to the top left corner just like when you try to maximize a 16-bit dos based application on your 32-bit Windows OS...
It just goes to the top left corner and then denies any movement, like when you maximize any window...
I mean the size remains the same but all the other properties are same as when any normal window is maximized..
Is there ne way to resolve this problem...??

And Mr. Christian Graus, congratulations for being the top expert of this month... :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900