Example #1
0
 public static Screen GetScreenFrom(Window window)
 {
     WindowInteropHelper windowInteropHelper = new WindowInteropHelper(window);
     System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.FromHandle(
         windowInteropHelper.Handle);
     Screen wpfScreen = new Screen(screen);
     return wpfScreen;
 }
Example #2
0
        public static Screen GetScreenFrom(Point point)
        {
            int x = (int)Math.Round(point.X);
            int y = (int)Math.Round(point.Y);

            // are x,y device-independent-pixels ??
            System.Drawing.Point drawingPoint = new System.Drawing.Point(x, y);
            System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.FromPoint(drawingPoint);
            Screen wpfScreen = new Screen(screen);

            return wpfScreen;
        }