public void ID_Monitors_Clear() { if (Mon1 != null) { Mon1.Hide(); Mon1 = null; } if (Mon2 != null) { Mon2.Hide(); Mon2 = null; } }
public void ID_Monitors() { ID_Monitors_Clear(); Application.DoEvents(); Thread.Sleep(500); Screen[] allScreens = Screen.AllScreens; Rectangle bounds = allScreens[0].Bounds; Mon1 = new SplashMonitor((bounds.X > 0) ? "2" : "1"); Mon1.SetBounds(bounds.X + bounds.Width, bounds.Height, 200, 200); Mon1.Show(); if (allScreens.Length > 1) { Rectangle bounds2 = allScreens[1].Bounds; Mon2 = new SplashMonitor((bounds2.X > 0) ? "2" : "1"); Mon2.SetBounds(bounds2.X + bounds2.Width, bounds2.Height, 200, 200); Mon2.Show(); allScreens = Screen.AllScreens; bounds = Screen.PrimaryScreen.Bounds; bounds2 = allScreens[1].Bounds; if (bounds2.X <= 0) { bounds2 = allScreens[0].Bounds; } MWin.SetBounds(bounds.X, bounds.Y, bounds.Width, bounds.Height); MWin.Update(); if (opciones.Monitors > 1 && MWin.publi != null) { MWin.publi.SetBounds(bounds2.X, bounds2.Y, bounds2.Width, bounds2.Height); MWin.publi.Update(); } } else { bounds = Screen.PrimaryScreen.Bounds; Mon1 = new SplashMonitor((bounds.X > 0) ? "2" : "1"); Mon1.SetBounds(bounds.X + bounds.Width, bounds.Height, 200, 200); Mon1.Show(); if (MWin.publi != null) { MWin.publi.Hide(); } } Update_Info(); }