Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# C#4.0
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 15-Nov-12 7:11am
Comments
Sergey Alexandrovich Kryukov at 15-Nov-12 14:37pm
   
Do you want to prevent Maximize/Minimize, or Resize as well?
--SA
HeinrichRichardSonButt at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
v2
Comments
HeinrichRichardSonButt at 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)

  Print Answers RSS
0 OriginalGriff 723
1 George Jonsson 370
2 BillWoodruff 277
3 Garth J Lancaster 250
4 Sergey Alexandrovich Kryukov 249
0 Sergey Alexandrovich Kryukov 10,764
1 Maciej Los 5,474
2 OriginalGriff 5,472
3 CPallini 3,819
4 BillWoodruff 3,594


Advertise | Privacy | Mobile
Web02 | 2.8.141030.1 | Last Updated 15 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100