Click here to Skip to main content
14,392,390 members

Simple Full Screen Method (Hides Taskbar)

Rate this:
4.85 (7 votes)
Please Sign up or sign in to vote.
4.85 (7 votes)
5 Jan 2016CPOL
Visual Studio Winforms 100% Full Screen Method


This is an easy way to put Winforms in 100% Full Screen.


I tried for hours to find a simple way to go full screen without using [DllImport("user32.dll")], etc. because the risk of the user closing the program with the taskbar still hidden was too great.

Using the Code

So after experimenting for a few hours, I discovered if I put FormWindowState.Normal before FormWindowState.Maximized, I could cover the taskbar every time.

This code uses KeyDown to look for Alt+Enter which toggles Form1 to full-screen. The Esc key will also cancel the full-screen.

Make sure you set Form1.KeyPreview = true for KeyDown to work.

You can ignore TopPanel. It's here to show you how to hide other controls when full-screen if needed.

Using TopMost is not necessary and is up to you.

Tested on Windows 7 Ultimate. If you use this on a later Windows version, please let us know how it works.

Size _size;
private void Form1_KeyDown(object sender, KeyEventArgs e)
    if (e.KeyCode == Keys.Escape && this.FormBorderStyle == FormBorderStyle.None)
        e.SuppressKeyPress = true;
        SendKeys.Send("%{ENTER}");    	// Alt+Enter again to cancel full screen
    if (e.Alt && e.KeyCode == Keys.Enter)	// Full Screen
        e.SuppressKeyPress = true;            		// the order is important
        isFullScreen = (FormBorderStyle == FormBorderStyle.None) ? true : false;
        LeftPanel.Visible = isFullScreen;
        if (!isFullScreen) _size = this.Size;
        this.Visible = false;
        this.FormBorderStyle = (isFullScreen) ? FormBorderStyle.Sizable : FormBorderStyle.None;
        this.WindowState = FormWindowState.Normal; // forces the taskbar to be covered
        this.WindowState = FormWindowState.Maximized;
        if (isFullScreen) this.Size = _size;
        this.Visible = true;
        if (isFullScreen) this.WindowState = FormWindowState.Normal;

        this.TopMost = !isFullScreen;

Points of Interest

This executes quickly with no unwanted artifacts.


  • 5th January, 2015: Initial version


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


About the Author

Software Developer (Senior) none
United States United States
No Biography provided

Comments and Discussions

Generalrestore to normal size in windows 10 pro Pin
truword4-Jan-16 22:09
professionaltruword4-Jan-16 22:09 
GeneralRe: restore to normal size in windows 10 pro Pin
trantrum5-Jan-16 3:01
professionaltrantrum5-Jan-16 3:01 
SuggestionRestore original size Pin
charga2-Jan-16 6:33
Membercharga2-Jan-16 6:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Posted 29 Dec 2015


13 bookmarked