There are situations where you want your application to go into a full screen presentation mode. This mode usually covers the whole desktop with a black background and the application sits in the middle of the screen.
How to do it?
I am presenting a simple solution using C#. In this application, I have made the application accept F11 as the toggle key to go into full screen mode and to revert back to its original state. To accomplish that, I set the
KeyPreview property of the form to
When the F11 key is pressed, I create another form that has its
WindowState property set to
Maximized, the background color is set to Black.
The trick here is to set the main application's form's owner to that of the second form. By setting the
Owner property, Windows will display the application on top of the black background window. The last thing to do is to set the
FormBorderStyle of the main form to
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);
_bFullScreenMode = true;
f.KeyUp +=new KeyEventHandler(Form1_KeyUp);
Form f = this.Owner;
this.Owner = null;
this.FormBorderStyle = FormBorderStyle.Sizable;
_bFullScreenMode = false;
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.