Click here to Skip to main content
15,907,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have set my form windows state to be maximize when I run the program. But how come it maximize until the bottom of the screen? It should be maximized on top of taskbar.. I mean if my screen resolution is 1024x768 the form should not maximize to its height of 768 because there is taskbar. It should maximize the height to 758 for example. How to do this?

this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;

I'm not sue, but give it a try. :)

Share this answer
private void Form1_Load(object sender, EventArgs e)
            this.Top = 0;
            this.Left = 0;

            this.Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height - 10);
Share this answer
Luiey Ichigo 17-Mar-14 4:23am    
I conclude both of jerrykid and krunal answer and got the screen that I want.
For jerry: I can't do the "Screen.PrimaryScreen.Bounds.Height - value" because running on Vista or XP or 7 or 8 will give a differ height

For Krunal, I do as your suggestion, it fill the whole area that I want :) but it not start as centerscreen event I set it on StartPosition. So I combine both of your answer as below;

Me.Size = New Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.WorkingArea.Size.Height) and all good. Thanks to both of you..

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