C# WinForm 关于窗体最大化时的是否全屏效果与是否遮盖任务栏
0.新建窗体 及添加按钮
1.
执行如下按钮事件
private void btnFormMax_Click(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
}
else
{
this.WindowState = FormWindowState.Maximized;
}
}
窗体最大化时 非全屏 不会遮盖任务栏
此时this.FormBorderStyle 默认为 Sizable
2.
执行如下按钮事件
private void btnFormMax_Click(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
}
else
{
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
}
}
窗体最大化时 会全屏 及遮盖任务栏
此时this.FormBorderStyle 为 None 不会显示窗体标题栏等相关
3.
执行如下按钮事件
private void btnFormMax_Click(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
}
else
{
this.FormBorderStyle = FormBorderStyle.None;
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
this.WindowState = FormWindowState.Maximized;
}
}
窗体最大化时 非全屏 不会遮盖任务栏
此时this.FormBorderStyle 为 None 不会显示窗体标题栏等相关
posted on 2008-11-22 11:52 freeliver54 阅读(11391) 评论(3) 编辑 收藏 举报