Winform-双监视器-无边界窗口-仅在最大主屏幕尺寸时才最大化

时间:2018-06-21 09:05:55

标签: c# .net winforms

我在使用多显示器系统和最大化无边界C#Winform窗口时遇到问题。我希望表单覆盖两个屏幕,但只覆盖主屏幕。

        Screen[] screens = Screen.AllScreens;    
        int height = 0;
        int width = 0;
        foreach (Screen screen in screens)
        {
            //take smallest height
            height = (screen.Bounds.Height >= height) ? screen.Bounds.Height : height;
            width += screen.Bounds.Width;
        }

        Size = new System.Drawing.Size(width, height);

        WindowState = FormWindowState.Maximized;
        FormBorderStyle = FormBorderStyle.None;

0 个答案:

没有答案