public sipSubWindow(Screen screen, Sip_window papa) { InitializeComponent(); this.sipScreenImage.Source = Util.getWindowScreen(screen); this.Topmost = true; papawindow = papa; }
public Sip_window(MainWindow mainwindow) /* main sip */ { findcolor = ContentPanelMaster.inputColor.ToColor(); subwindows = new List <sipSubWindow>(); var screens = Screen.AllScreens; System.Drawing.Rectangle mainwindowRect = new System.Drawing.Rectangle((int)Application.Current.MainWindow.Left, (int)Application.Current.MainWindow.Top, (int)mainwindow.Width, (int)mainwindow.Height); Screen activeScreen = null; foreach (var screen in screens) { System.Drawing.Rectangle screenrect = new System.Drawing.Rectangle((int)screen.WorkingArea.Left, (int)screen.WorkingArea.Top, (int)screen.WorkingArea.Width, (int)screen.WorkingArea.Height); if (mainwindowRect.IntersectsWith(screenrect)) { Console.WriteLine("OVERLAP!\n {0} {1} {2} {3} \n{4} {5} {6} {7}", Application.Current.MainWindow.Left, Application.Current.MainWindow.Top, Application.Current.MainWindow.Width, Application.Current.MainWindow.Height, screenrect.Left, screenrect.Top, screenrect.Width + screenrect.Left, screenrect.Height + screenrect.Top); activeScreen = screen; this.Left = activeScreen.Bounds.Left; this.Top = activeScreen.Bounds.Top; this.Width = activeScreen.Bounds.Width; this.Height = activeScreen.Bounds.Height; Console.WriteLine("{0} {1} {2} {3}", this.Left, this.Top, this.Width, this.Height); break; } } InitializeComponent(); this.sipScreenImage.Source = Util.getWindowScreen(activeScreen); if (Properties.Settings.Default.SipType == 0) { this.createSubwindows(screens, activeScreen); } sipControl _control = new sipControl(this, ContentPanelMaster.inputColor.ToColor()) { RenderTransform = new TranslateTransform(Application.Current.MainWindow.Left - activeScreen.Bounds.Left, Application.Current.MainWindow.Top - activeScreen.Bounds.Top) }; control = _control; this.Canvas.Children.Add(control); this.Topmost = true; }