C# 全屏的显示和隐藏
C#的全屏问题,这里有一个链接http://blog.csdn.net/wuyazhe/article/details/5728286
该例子,我只是在wince上面测试,在测试的时候,关于findwindow:Hwnd = FindWindow("HHTaskBar", null);这样,在wince上面,工具栏名字是HHTaskBar
public class FullScreen { //private static Rectangle m_rectOld= new Rectangle(); public static bool SetFullScreen() { int Hwnd = 0; Hwnd = FindWindow("HHTaskBar", null); if (Hwnd == 0) return false; ShowWindow(Hwnd, SW_HIDE); Rectangle rectFull = Screen.PrimaryScreen.Bounds; //SystemParametersInfo(SPI_GETWORKAREA, 0, ref m_rectOld, SPIF_UPDATEINIFILE); SystemParametersInfo(SPI_SETWORKAREA, 0, ref rectFull, SPIF_UPDATEINIFILE); return true; } public static bool SetNormalScreen() { int Hwnd = 0; Hwnd = FindWindow("HHTaskBar", null); if (Hwnd == 0) return false; ShowWindow(Hwnd, SW_SHOW); //SystemParametersInfo(SPI_SETWORKAREA, 0, ref m_rectOld, SPIF_UPDATEINIFILE); return true; } [DllImport("coredll.dll")] public static extern int ShowWindow(int hwnd, int nCmdShow); public const int SW_SHOW = 5; public const int SW_HIDE = 0; [DllImport("coredll.dll")] public static extern int SystemParametersInfo(int uAction, int uParam, ref Rectangle lpvParam, int fuWinIni); public const int SPIF_UPDATEINIFILE = 0X1; public const int SPI_SETWORKAREA = 47; public const int SPI_GETWORKAREA = 48; [DllImport("coredll.dll")] private static extern int FindWindow(string lpClassName, string lpWindowName); }