Wince全屏或者隐藏任务栏

来源:互联网 发布:js判断是否等于1 编辑:程序博客网 时间:2024/05/01 09:33
全屏使用示例:
FormScreen.ShowFullScreen( "你的窗体");

隐藏任务栏:
FormScreen.ShowHHTaskBar();

显示任务栏:
FormScreen.HideHHTaskBar();

设备的屏幕宽度:
FormScreen.Width;

设备的屏幕高度:

FormScreen.Height


public class FormScreen    {         const uint SHFS_SHOWTASKBAR = 0x0001;         const uint SHFS_HIDETASKBAR = 0x0002;         const uint SHFS_SHOWSIPBUTTON = 0x0004;         const uint SHFS_HIDESIPBUTTON = 0x0008;         const uint SHFS_SHOWSTARTICON = 0x0010;         const uint SHFS_HIDESTARTICON = 0x0020;         const int SW_HIDE = 0;         const int SW_SHOWNORMAL = 1;         const int SW_SHOWMINIMIZED = 2;         const int SW_SHOWMAXIMIZED = 3;         const int SW_SHOWNOACTIVATE = 4;         const int SW_RESTORE = 9;         const int SW_SHOWDEFAULT = 10;         [DllImport("aygshell.dll")]             private static extern uint SHFullScreen(IntPtr hwndRequester, uint dwState);         [DllImport("coredll.dll")]            private static extern IntPtr GetCapture();         [DllImport("CoreDll")]            private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);         [DllImport("CoreDll")]            private static extern bool ShowWindow(IntPtr hwnd, int nCmdShow);         /// <summary>         /// 使程序全屏显示         /// </summary>         /// <param name="objForm"></param>         public static void ShowFullScreen(System.Windows.Forms.Form objForm)         {             objForm.Capture = true;             HideHHTaskBar();             IntPtr hwnd = GetCapture();             objForm.Capture = false;             SHFullScreen(hwnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON | SHFS_HIDESTARTICON);//全屏化窗口         }         /// <summary>         /// 显示任务栏         /// </summary>         public static void ShowHHTaskBar()         {             IntPtr lpClassName = FindWindow("HHTaskBar", null);             ShowWindow(lpClassName, SW_SHOWNORMAL); //显示任务栏         }         /// <summary>         /// 隐藏任务栏         /// </summary>         public static void HideHHTaskBar()         {             IntPtr lpClassName = FindWindow("HHTaskBar", null);             ShowWindow(lpClassName, SW_HIDE); //隐藏任务栏         }         /// <summary>        /// 获取设备的屏幕宽度        /// </summary>        public static int Width{           get{               return Screen.PrimaryScreen.Bounds.Width;           }        }        /// <summary>        /// 获取设备的屏幕高度        /// </summary>        public static int Height{            get{                return Screen.PrimaryScreen.Bounds.Height;            }        }    } 

文章转载自:http://blog.csdn.net/zh2305/archive/2008/08/28/2844169.aspx


原创粉丝点击