The way the form is full screen:
Hide the taskbar, set the work area
Maximize form, set form border style
Full screen form code public partial class Frmfullscreen:form {Boolean M_isfullscreen = false;//tag is full screen Rect
Angle Rectold = Rectangle.empty;
Public Frmfullscreen () {InitializeComponent (); ///<summary>///Full Screen button click event///</summary>///<param name= "sender "></param>///<param name=" E "></param> private void Btnfullscreen_click (object sen
Der, EventArgs e) {m_isfullscreen =!m_isfullscreen;//dot once full screen, then point to restore.
Setformfullscreen (M_isfullscreen); This.
SuspendLayout (); if (M_isfullscreen)//Full screen {this.
WindowState = formwindowstate.maximized; This.
FormBorderStyle = Formborderstyle.none; else//restore TODO: The restored form should match the size in front of the full screen {this.
WindowState = Formwindowstate.normal;This.
FormBorderStyle = formborderstyle.sizable; } this.
ResumeLayout (FALSE); ///<summary>///Full screen shortcut features, F11 equivalent to a stand-alone button, ESC health, if full screen exit full screen///</summary>///& Lt;param name= "Sender" ></param>///<param name= "E" ></param> private void BTNFULLSC
Reen_keydown (object sender, KeyEventArgs e) {if (E.keycode = = keys.f11) {
Btnfullscreen.performclick ();
E.handled = true;
else if (E.keycode = = Keys.escape)//esc keyboard exits full screen {if (m_isfullscreen)
{e.handled = true;
Setformfullscreen (FALSE); This. WindowState = formwindowstate.normal;//Restore this.
FormBorderStyle = formborderstyle.sizable;
}}///<summary> Set Full-screen or this cancels full-screen///</summary>///<param name= "fullscreen" >true: Full screen false: Restore </param&
Gt When <param name= "Rectold" > settings, this parameter returns the original size, with this parameter set restore </param>///<returns> setting result </RETURNS&G
T Public Boolean Setformfullscreen (Boolean fullscreen)//, ref Rectangle Rectold {Rectangle rectold=re Ctangle.
Empty;
Int32 hwnd = 0;
hwnd = FindWindow ("Shell_traywnd", null);//Get the handle of the taskbar if (hwnd = = 0) return false; if (fullscreen)/full screen {ShowWindow (hwnd, sw_hide);/hide taskbar systemparametersi NFO (Spi_getworkarea, 0, ref rectold, Spif_updateinifile)//get screen range Rectangle rectfull = Screen.primarys Creen.
bounds;//Full-screen Range SystemParametersInfo (spi_setworkarea, 0, ref rectfull, spif_updateinifile);//form Full screen display } else//Restore {SHowwindow (hwnd, SW_SHOW)//display taskbar SystemParametersInfo (spi_setworkarea, 0, ref rectold, Spif_updateinifi
LE);//Form Restore} return true; #region User32.dll [DllImport ("user32.dll", EntryPoint = "ShowWindow")] public static ext
Ern Int32 ShowWindow (Int32 hwnd, Int32 ncmdshow); Public Const Int32 Sw_show = 5;
Public Const Int32 Sw_hide = 0; [DllImport ("user32.dll", EntryPoint = "SystemParametersInfo")] private static extern Int32 SystemParametersInfo (I
Nt32 uaction, Int32 uparam, ref Rectangle Lpvparam, Int32 fuWinIni);
Public Const Int32 Spif_updateinifile = 0x1;
Public Const Int32 Spi_setworkarea = 47;
Public Const Int32 Spi_getworkarea = 48; [DllImport ("user32.dll", EntryPoint = "FindWindow")] private static extern Int32 FindWindow (string lpclassname, S
Tring Lpwindowname); #endregion}