Click here to Skip to main content
15,900,818 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
How to maximize the windows Form programmatically? with form size also
Posted
Updated 27-Apr-20 4:19am
Comments
Jameel VM 5-Feb-13 9:25am    
You mean fullscreen?
GopinathSk 5-Feb-13 9:28am    
yes
Kishor Deshpande 5-Feb-13 9:25am    
Adding solution..
Jameel VM 5-Feb-13 9:31am    
from which form you try maximize?
GopinathSk 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

C#
private void button1_Click(object sender, EventArgs e)
{
    for (int i = 0; i < Application.OpenForms.Count; i++)
    {
        Application.OpenForms[i].WindowState=FormWindowState.Maximized;
    }
}

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 :)
Also for panel1,
Add line of code,
C#
panel1.Dock=DockStyle.Fill;

Let me know if you need any more help..
 
Share this answer
 
v5
Comments
Kishor Deshpande 5-Feb-13 10:27am    
Thanks Abhishek for editing it. :)
I missed to add a code block for that line of code. :(
If you want to maximize the form programmatically, set the WindowState property to maximized.
C#
this.WindowState = FormWindowState.Maximized;


If you want to set the window to full screen you can try like this:
C#
this.TopMost = true;
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
 
Share this answer
 
You can maximize the form you want from another form like below
C#
Form1 form1=new Form1();
          form1.Show();
          form1.WindowState = FormWindowState.Maximized;


Hope this helps
 
Share this answer
 

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