百度了,看到有说调用API的,还有设置form.size的。对于API这个我不怎么懂,有高手发下带注释的代码吗?

解决方案 »

  1.   

    设置无边框窗体,自己加上title,默认就是全屏了
      

  2.   

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Runtime.InteropServices;namespace GlobalTechnologyInc.SnmpProject.CustomClass
    {
        /// <summary>
        /// Selected Win AI Function Calls
        /// </summary>    class WindowsFullScreenApi
        {
            [DllImport("user32.dll", EntryPoint = "GetSystemMetrics")]
            public static extern int GetSystemMetrics(int which);        [DllImport("user32.dll")]
            public static extern void
                SetWindowPos(IntPtr hwnd, IntPtr hwndInsertAfter,
                             int X, int Y, int width, int height, uint flags);        private const int SM_CXSCREEN = 0;
            private const int SM_CYSCREEN = 1;
            private static IntPtr HWND_TOP = IntPtr.Zero;
            private const int SWP_SHOWWINDOW = 64; // 0x0040        public static int ScreenX
            {
                get { return GetSystemMetrics(SM_CXSCREEN); }
            }        public static int ScreenY
            {
                get { return GetSystemMetrics(SM_CYSCREEN); }
            }        public static void SetWinFullScreen(IntPtr hwnd)
            {
                SetWindowPos(hwnd, HWND_TOP, 0, 0, ScreenX, ScreenY, SWP_SHOWWINDOW);
            }
        }
    }
      

  3.   

    FormWindowState tempWindowState;//全局变量全屏
    tempWindowState = this.WindowState;
    this.FormBorderStyle = FormBorderStyle.None;
    this.WindowState = FormWindowState.Maximized;
    this.SetVisibleCore(true);恢复
    this.FormBorderStyle = FormBorderStyle.Sizable;
    this.WindowState = tempWindowState;