Click here to Skip to main content
Click here to Skip to main content
Go to top

Show a WinForm in FullScreen mode using C#

, 16 Apr 2008
Rate this:
Please Sign up or sign in to vote.
This article contents source code and demo show how to set your WinForm in Full screen mode

Introduction

I have read some articles about FullScreen mode in WinForm using C#. Per example this one on codeproject with the name "Full Screen mode in C#". This example was not satisfized me. I have develope another one and i thing it can be really better, depend of your project!

Description

The source code contents two zip files, the first one is the source code for the FullScreenMode.dll and the second is a test programm to improve the full screen mode on a WinForm. You have to build the associated FullScreenMode project to get a new FullScreenMode.dll. There is one FullScreenMode.dll in the demo file. In the Demo programm, you can only press F11 to view the Form in Full screen mode. Pressed F11 again will reset to the normal Form.

FullScreenMode

The most important in the HandleTaskBar class is to show or hide the Windows taskbar using WinAPI (user32.dll). The methods showTaskBar() and hideTaskBar() will show or hide the TaskBar depend of the screen mode. The methods FindWinDow() and SetWindowPos() must be defined.

/// <span class="code-SummaryComment"><summary></span>

/// Show the TaskBar.

/// <span class="code-SummaryComment"></summary></span>

public static void showTaskBar()

{

     int hWnd = FindWindow("Shell_TrayWnd", "");

     SetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW);

}

/// <span class="code-SummaryComment"><summary></span>

/// Hide the TaskBar.

/// <span class="code-SummaryComment"></summary></span>

public static void hideTaskBar()

{

      int hWnd = FindWindow("Shell_TrayWnd", "");

      SetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);

}


The source code is very easy to understand.

But any suggestion will be welcome.

Thanks!

Adiphe

License

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

Share

About the Author

Adiphe
Software Developer
Germany Germany
.Net, C#, VB Development

Comments and Discussions

 
SuggestionPer my test, it's better not to hide/unhide the form PinmemberLeon Zeng20-Jun-14 21:14 
GeneralThis is Great!!! Pinmembertonymark0915-Jun-10 23:37 
GeneralUnable to unzip it! Pinmemberyudyzhao14-Apr-08 1:02 
GeneralRe: Unable to unzip it! PinmemberS.Captive7-Jun-09 7:54 
GeneralThanks for you help PinmemberJackChen198718-Oct-07 15:44 
Generalzip file unreadable Pinmemberm_s_t22-Sep-07 11:09 
GeneralRe: zip file unreadable PinmemberAdiphe22-Sep-07 22:03 
QuestionDifference? Pinmembertermi10-Oct-06 4:37 
AnswerRe: Difference? PinmemberAdiphe10-Oct-06 4:43 
GeneralRe: Difference? Pinmembertermi10-Oct-06 19:47 

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

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

| Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 16 Apr 2008
Article Copyright 2006 by Adiphe
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid