public static WpfScreen GetScreenFrom(Window window) { var windowInteropHelper = new WindowInteropHelper(window); var screen = Screen.FromHandle(windowInteropHelper.Handle); var wpfScreen = new WpfScreen(screen); return wpfScreen; }
public static WpfScreen GetScreenFrom(Window window) { var windowInteropHelper = new WindowInteropHelper(window); var screen = Screen.FromHandle(windowInteropHelper.Handle); var wpfScreen = new WpfScreen(screen); return(wpfScreen); }
private static Size GetWindowSize(IntPtr hWnd) { var window = (Window)HwndSource.FromHwnd(hWnd).RootVisual; var screen = WpfScreen.GetScreenFrom(window); var size = new Size(screen.WorkingArea.Width + 8, screen.WorkingArea.Height + 8); return(size); }
public static WpfScreen GetScreenFrom(Point point) { int x = (int)Math.Round(point.X); int y = (int)Math.Round(point.Y); // are x,y device-independent-pixels ?? var drawingPoint = new System.Drawing.Point(x, y); Screen screen = Screen.FromPoint(drawingPoint); var wpfScreen = new WpfScreen(screen); return(wpfScreen); }
public static WpfScreen GetScreenFrom(Point point) { int x = (int) Math.Round(point.X); int y = (int) Math.Round(point.Y); // are x,y device-independent-pixels ?? var drawingPoint = new System.Drawing.Point(x, y); Screen screen = Screen.FromPoint(drawingPoint); var wpfScreen = new WpfScreen(screen); return wpfScreen; }