您的位置:首页 > 编程语言 > C#

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

2010-08-09 13:05 483 查看
定义一个全局变量 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++;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: