c# 无边框窗体最大化时挡住了系统的任务栏,怎么样不让窗体挡住任务栏?

如题所述

你好!当点击你自己设置的最大化按钮时,添加下面的代码,获得工作区域的大小即可。private void button1_Click(object sender, EventArgs e) { if (WindowState == FormWindowState.Normal) { this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); WindowState = FormWindowState.Maximized; } else { WindowState = FormWindowState.Normal; } this.Refresh(); }
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-04-02

如果不挡住任务栏,那么需要自己手动指定 FORM 的高度值,Form_Load 中,使用如下的代码:

private void Form1_Load(object sender, EventArgs e)
{
this.Top = 0;
this.Left = 0;
this.Width = Screen.PrimaryScreen.WorkingArea.Width;
this.Height = Screen.PrimaryScreen.WorkingArea.Height;
}

本回答被网友采纳
第2个回答  2013-04-02
TopMost=false