Full full screen form method:
1. Hide the taskbar
2. Set the Work Area
3. Maximize forms
This method is commonly used in wince/mobile/PPC, but the API Declaration must be modified to reference coredll. dll.
Bool fullscreen = false; <br/> rectangle rect = new rectangle (); <br/> private void button4_click (Object sender, eventargs E) <br/>{< br/> fullscreen =! Fullscreen; // loop. Click full screen once, and then click Restore. <Br/> setfullscreen (fullscreen, ref rect); <br/> If (fullscreen) <br/>{< br/> This. windowstate = formwindowstate. maximized; // full screen <br/>}< br/> else <br/>{< br/> This. windowstate = formwindowstate. normal; // restore <br/>}</P> <p> /// <summary> <br/> // set full screen or cancel full screen <br/> /// </Summary> <br/> /// <Param name = "fullscreen"> true: full Screen false: Restore </param> <br/> // <Param name = "rectold"> when set, this parameter returns the original size, use this parameter to set recovery </param> <br/> // <returns> setting result </returns> <br/> Public static bool setfullscreen (bool fullscreen, ref rectangle rectold) <br/>{< br/> int hwnd = 0; <br/> hwnd = findwindow ("shell_traywnd", null ); <br/> If (hwnd = 0) return false; <br/> If (fullscreen) <br/>{< br/> showwindow (hwnd, sw_hide ); <br/> rectangle rectfull = screen. primaryscreen. bounds; <br/> systemparametersinfo (spi_getworkarea, 0, ref rectold, spif_updateinifile); // get <br/> systemparametersinfo (spi_setworkarea, 0, ref rectfull, done ); // set <br/>}< br/> else <br/>{< br/> showwindow (hwnd, sw_show); <br/> systemparametersinfo (spi_setworkarea, 0, ref rectold, spif_updateinifile); <br/>}< br/> return true; <br/>}</P> <p> [dllimport ("user32.dll ", entrypoint = "showwindow")] <br/> Public static extern int showwindow (INT hwnd, int ncmdshow); <br/> Public const int sw_show = 5; public const int sw_hide = 0; </P> <p> [dllimport ("user32.dll", entrypoint = "systemparametersinfo")] <br/> Private Static extern int systemparametersinfo (INT uaction, int uparam, ref rectangle lpvparam, int fuwinini); <br/> Public const int spif_updateinifile = 0x1; <br/> Public const int spi_setworkarea = 47; <br/> Public const int spi_getworkarea = 48; </P> <p> [dllimport ("user32.dll ", entrypoint = "findwindow")] <br/> Private Static extern int findwindow (string lpclassname, string lpwindowname );