C# Winform 怎么让界面全屏显示

定义一个全局变量  int num=0;       

 

private void 全屏显示ToolStripMenuItem_Click(object sender, EventArgs e)
 {
            this.ResizeRedraw = false;
            Point p = new Point();
            p.X = 0; p.Y = 0;
            int X = Screen.PrimaryScreen.Bounds.Width;
            int Y = Screen.PrimaryScreen.Bounds.Height;

            if ((num % 2) != 0)//判断奇数还是偶数
                this.FormBorderStyle = FormBorderStyle.None;//奇数全屏
            else
                this.FormBorderStyle = FormBorderStyle.Sizable;//偶数恢复原样

            this.Location = p;
            this.Height = Y;
            this.Width = X;
            this.ResizeRedraw = true;

            num++;
}

你可能感兴趣的:(object,C#,WinForm)