Click here to Skip to main content
Licence CPOL
First Posted 10 Oct 2006
Views 44,407
Downloads 1,505
Bookmarked 24 times

Show a WinForm in FullScreen mode using C#

By | 16 Apr 2008 | Article
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.

/// <summary>

/// Show the TaskBar.

/// </summary>

public static void showTaskBar()

{

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

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

}

/// <summary>

/// Hide the TaskBar.

/// </summary>

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)

About the Author

Adiphe

Software Developer

Germany Germany

Member

.Net, C#, VB Development

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralThis is Great!!! Pinmembertonymark0923:37 15 Jun '10  
GeneralUnable to unzip it! Pinmemberyudyzhao1:02 14 Apr '08  
GeneralRe: Unable to unzip it! PinmemberS.Captive7:54 7 Jun '09  
GeneralThanks for you help PinmemberJackChen198715:44 18 Oct '07  
Generalzip file unreadable Pinmemberm_s_t11:09 22 Sep '07  
GeneralRe: zip file unreadable PinmemberAdiphe22:03 22 Sep '07  
QuestionDifference? Pinmembertermi4:37 10 Oct '06  
AnswerRe: Difference? PinmemberAdiphe4:43 10 Oct '06  
GeneralRe: Difference? Pinmembertermi19:47 10 Oct '06  
GeneralRe: Difference? PinmemberAdiphe0:04 11 Oct '06  
GeneralRe: Difference? Pinmembertermi4:44 11 Oct '06  
AnswerRe: Difference? [modified] PinmemberAdiphe5:15 11 Oct '06  
GeneralRe: Difference? PinmemberHercules010:00 1 Apr '09  
GeneralRe: Difference? PinmemberAdiphe6:47 1 Apr '09  
Generalerrate links PinmemberMrBabba4:33 10 Oct '06  
GeneralRe: errate links PinmemberAdiphe5:01 10 Oct '06  

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.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 16 Apr 2008
Article Copyright 2006 by Adiphe
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid