System.Windows.Forms.Screen[] screens = System.Windows.Forms.Screen.AllScreens;
System.Windows.Forms.Screen currentScreen = System.Windows.Forms.Screen.FromRectangle(DisplayRectangle);
if (screens.Length >= 2)
{
for (int j = 0; j < screens.Length; j++)
{
System.Windows.Forms.Screen childerScreen = screens[j];
//if ((childerScreen != currentScreen) && (childerScreen != System.Windows.Forms.Screen.PrimaryScreen))
if ((childerScreen.DeviceName != currentScreen.DeviceName))
{
//获取扩展屏
this.Width = childerScreen.WorkingArea.Width;
this.Height = childerScreen.WorkingArea.Height;
this.Top = 0;
this.Left = childerScreen.WorkingArea.Left;
//isSecondScreen = true;
}
}
}
else
{
this.Width = currentScreen.WorkingArea.Width;
this.Height = currentScreen.WorkingArea.Height;
this.Top = 0;
this.Left = currentScreen.WorkingArea.Left;
}