public partial class Form1 : Form
{
bool Maximize, Fullscreen;
Size OldSize;
Point OldPos;
public Form1()
{
InitializeComponent();
Maximize = this.WindowState == FormWindowState.Maximized;
Fullscreen = false;
}
private void GoMaximize()
{
Maximize = !Maximize;
this.WindowState = Maximize ? FormWindowState.Maximized : FormWindowState.Normal;
}
private void GoFullscreen()
{
Fullscreen = !Fullscreen;
if (Fullscreen)
{
Form f = new Form();
OldSize = this.Size;
OldPos = this.Location;
this.Owner = f;
this.FormBorderStyle = FormBorderStyle.None;
this.Left = this.Top = 0;
this.Width = Screen.PrimaryScreen.Bounds.Width;
this.Height = Screen.PrimaryScreen.Bounds.Width;
f.Show();
}
else
{
Form f = this.Owner;
this.Owner = null;
f.Close();
this.FormBorderStyle = FormBorderStyle.Sizable;
this.Location = OldPos;
this.Size = OldSize;
}
}
private void button1_Click(object sender, EventArgs e)
{
GoMaximize();
}
private void button2_Click(object sender, EventArgs e)
{
GoFullscreen();
}
}
Przerób pod swoje potrzeby. Poza tym pierwszy link w google: Fullscreen i Maximize.
Pozdrawiam, Wronq!