Junior Spellweaver
- Joined
- Nov 26, 2008
- Messages
- 196
- Reaction score
- 62
This was requested by a friend, so I thought I'd post it here.
Here is just a simple method for an application to enter to a full screen mode without writing a lot of resizing code in the main application.
Here is just a simple method for an application to enter to a full screen mode without writing a lot of resizing code in the main application.
Code:
private void Form1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
if ( e.KeyData == Keys.F11)
{
if (_bFullScreenMode == false)
{
Form2 f = new Form2();
this.Owner = f;
this.FormBorderStyle = FormBorderStyle.None;
this.Left = (Screen.PrimaryScreen.Bounds.Width/2 - this.Width/2);
this.Top = (Screen.PrimaryScreen.Bounds.Height/2 - this.Height/2);
f.Show();
_bFullScreenMode = true;
f.KeyUp +=new KeyEventHandler(Form1_KeyUp);
}
else
{
Form f = this.Owner;
this.Owner = null;
f.Close();
this.FormBorderStyle = FormBorderStyle.Sizable;
_bFullScreenMode = false;
}
}
}
Attachments
You must be registered for see attachments list
Last edited: