winforms能否做出全屏的效果?
我想把我做的一个小游戏搞成全屏的.

解决方案 »

  1.   

    static class Program
        {
            [DllImport("user32.dll", EntryPoint = "FindWindow")]
            public static extern IntPtr FindWindow(
                string lpClassName,
                string lpWindowName
            );
            [DllImport("user32.dll", EntryPoint = "ShowWindow")]
            public static extern int ShowWindow(
                IntPtr hwnd,
                int nCmdShow
            );
            public const int SW_HIDE = 0;
            public const int SW_SHOW = 5;
            /// <summary>
            /// 应用程序的主入口点。
            /// </summary>
            [STAThread]
            static void Main()
            {
                IntPtr hTaskBar = FindWindow("Shell_TrayWnd", "");
                ShowWindow(hTaskBar, SW_HIDE);
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
                ShowWindow(hTaskBar, SW_SHOW);
            }
        }http://community.csdn.net/Expert/topic/5299/5299321.xml?temp=.5996668
      

  2.   

    请问: [DllImport("user32.dll", EntryPoint = "FindWindow")] 是什么意思,小弟刚接触C#.谢谢!
      

  3.   

    DllImport是就是调用系统的api,
    其实这个效果也不用调用api的,你先把form的BorderStyle属性设置为None,然后通过获取当前屏幕的分辨率就可以了
      

  4.   

    谢谢,我做出这个效果了,让我再琢磨琢磨怎样在游戏过程中按下ESC退出程序或者弹出退出提示对话框.
    我用一个按钮来CancelButton,可以发现我想Visable = true;ESC就没效了.
    让我考虑考虑,谢谢大哥们的帮助.
      

  5.   

    你设置他的属性就行
    可以捕捉键盘的点击事件,把ESC捕捉到后用一个msgbox显示判断,然后再改变他的属性就可以了