Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
when i minimized the form will be in the size (1011, 680);
but when i maximized the form will be maximized but size willbe (1011, 680);remaining space will be empty..all controls are not same size

i wrote this code


C#
this.MinimumSize = new Size(1011, 680);
            this.MaximumSize = new Size(1011,680);
Posted
Updated 16-May-14 18:44pm
v2

Hi, what you are doing is setting the size of the screen when it is minimised. The magic you need is:

C#
this.WindowState = FormWindowState.Minimized;

and
C#
this.WindowState = FormWindowState.Maximized;
 
Share this answer
 
Comments
hilbert hussen 16-May-14 8:30am    
while iam maximized the right side space getting..not getting same size with minimize and mazimize
Keith Barrow 16-May-14 8:35am    
Hi, can you update the *question* with what you want to happen please as this isn't clear to me - the maximised and minimised screens should be different sizes.
CPallini 16-May-14 8:46am    
5 for the magic.
hilbert hussen 16-May-14 8:48am    
means
To maximize (or minimize) a Windows Form, set its WindowState property (see MSDN[^]).
 
Share this answer
 
Comments
hilbert hussen 16-May-14 8:36am    
Hi, can you update the *question* with what you want to happen please as this isn't clear to me - the maximised and minimised screens should be different sizes.
Keith Barrow 16-May-14 8:38am    
I'm 99.9% certain that's not what you meant to post :)
hilbert hussen 16-May-14 8:42am    
Sorry,when i minimized the form will be in the size (1011, 680);
but when i maximized the form will be maximized but size willbe (1011, 680);remaining space will be empty..all controls are not same size

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