我在使用多显示器系统和最大化无边界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;