Example #1
0
 public static WpfScreen GetScreenFrom(Window window)
 {
     var windowInteropHelper = new WindowInteropHelper(window);
     var screen = Screen.FromHandle(windowInteropHelper.Handle);
     var wpfScreen = new WpfScreen(screen);
     return wpfScreen;
 }
Example #2
0
        public static WpfScreen GetScreenFrom(Window window)
        {
            var windowInteropHelper = new WindowInteropHelper(window);
            var screen    = Screen.FromHandle(windowInteropHelper.Handle);
            var wpfScreen = new WpfScreen(screen);

            return(wpfScreen);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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;
        }