Click here to Skip to main content
11,576,064 members (62,050 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
How to maximize the windows Form programmatically? with form size also
Posted 5-Feb-13 3:16am
JemiM at 5-Feb-13 9:25am
You mean fullscreen?
GopinathSk at 5-Feb-13 9:28am
Kishor Deshpande at 5-Feb-13 9:25am
Adding solution..
JemiM at 5-Feb-13 9:31am
from which form you try maximize?
GopinathSk at 5-Feb-13 9:35am
sir, now i create a simple notepad application in c#..In that i place a button for make the application into full screen...

yours answer is works only as form properties...

But i wanna to make the app full screen with its form
Kishor Deshpande at 5-Feb-13 9:36am
Have you tried with my solution? It maximises all the forms in your application on button click :)..
GopinathSk at 5-Feb-13 9:39am
yes i tried.first of all, i placed a panel1 in that form1 but panel1 is in same size
JemiM at 5-Feb-13 9:41am
what's the problem now actually?
GopinathSk at 5-Feb-13 9:45am
sorry for confusing it possible to increase the panel1 by code..
Kishor Deshpande at 5-Feb-13 9:58am
is the answer :)
Kishor Deshpande at 5-Feb-13 9:50am
Add this line of code..
GopinathSk at 5-Feb-13 9:57am
yeah it works very well sir.......thanks a lot
Kishor Deshpande at 5-Feb-13 10:00am
Gopinath: Could you please upvote my answer and accept it as solution??
Thanks. :)
JemiM at 5-Feb-13 9:53am
i have add a new solution.Please edit the current question to panel
Kishor Deshpande at 5-Feb-13 9:56am
Jemi, you could have just modified your earlier answer, but anyways, he wants his panel to be of same size as of form not of size 200,200
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

        private void button1_Click(object sender, EventArgs e)
            for (int i = 0; i < Application.OpenForms.Count; i++)
If you wish to have it maximised for only few types of forms, you can put if condition in that for loop.
These lines will make all openforms in your application maximised Smile | :)
Also for panel1,
Add line of code,
Let me know if you need any more help..
Kishor Deshpande at 5-Feb-13 10:27am
Thanks Abhishek for editing it. :)
I missed to add a code block for that line of code. :(
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

If you want to maximize the form programmatically, set the WindowState property to maximized.
this.WindowState = FormWindowState.Maximized;

If you want to set the window to full screen you can try like this:
        this.TopMost = true;
        this.FormBorderStyle = FormBorderStyle.None;
        this.WindowState = FormWindowState.Maximized;
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

You can maximize the form you want from another form like below
  Form1 form1=new Form1();
            form1.WindowState = FormWindowState.Maximized;

Hope this helps

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 295
1 F-ES Sitecore 140
2 OriginalGriff 125
3 Dave Kreskowiak 80
4 Abhinav S 78
0 OriginalGriff 705
1 Sergey Alexandrovich Kryukov 630
2 Abhinav S 438
3 F-ES Sitecore 410
4 Suvendu Shekhar Giri 365

Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 5 Feb 2013
Copyright © CodeProject, 1999-2015
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