木子屋 Dnawo's BLOG

Winform窗体最大化遮盖系统任务栏解决方法

👤 dnawo 📅 2015-01-18 👁 4679 👍 0 💬 0 🔄 本站原创
今天将一个Winform窗体设计成最大化后,运行发现它遮盖了系统任务栏,经多次测试发现原来是同时禁用了最大化按钮且设置窗体边框样式为FormBorderStyle.FixedSingle才会出现这种情况:

private void Form1_Load(object sender, EventArgs e)
{
    this.MaximizeBox = false;
    this.FormBorderStyle = FormBorderStyle.FixedSingle;
    this.WindowState = FormWindowState.Maximized;
}

调整下顺序即可解决:

private void Form1_Load(object sender, EventArgs e)
{
    this.WindowState = FormWindowState.Maximized;
    this.MaximizeBox = false;
    this.FormBorderStyle = FormBorderStyle.FixedSingle;            
}

评论(0)

暂无评论。

计算题
评论需审核通过后显示
← 上一篇 [ASP]CodePage、Response.CodePage和… 下一篇 → 我是如何在SQLServer中处理每天四亿三千万记录的[转]