首页 > 其他 > 详细

C# 全屏的显示和隐藏

时间:2014-02-13 15:55:28      阅读:322      评论:0      收藏:0      [点我收藏+]

C#的全屏问题,这里有一个链接http://blog.csdn.net/wuyazhe/article/details/5728286

该例子,我只是在wince上面测试,在测试的时候,关于findwindow:Hwnd = FindWindow("HHTaskBar", null);这样,在wince上面,工具栏名字是HHTaskBar

bubuko.com,布布扣
    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);
    }
View Code

C# 全屏的显示和隐藏

原文:http://www.cnblogs.com/cxiaoln/p/3547536.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!