0

我正在使用带有borderstyle = none的窗口形式。当我使用以下代码最大化我的窗口时,它会最大化以覆盖托盘栏。

    private void pb_max_Click(object sender, EventArgs e)
    {
        if (WindowState == FormWindowState.Maximized)
        {
            WindowState = FormWindowState.Normal;
            pb_max.Image = GomeeSoft.Properties.Resources.buttonmax;
        }
        else
        {
            WindowState = FormWindowState.Maximized;
            pb_max.Image = GomeeSoft.Properties.Resources.buttonreturn;
        }
    }

您如何安全地最大化以使框架仅在工作区中最大化?

4

1 回答 1

1

也许是这样的:

this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;

来自 MSDN:

The working area is the desktop area of the display, excluding taskbars, docked windows, and docked tool bars.

于 2013-01-30T05:44:49.313 回答