コード例 #1
0
ファイル: ScreenService.cs プロジェクト: Jon2G/Xamarin.Tools
        public static ScreenService GetScreenFrom(Window window)
        {
            WindowInteropHelper windowInteropHelper = new WindowInteropHelper(window);
            Screen        screen    = System.Windows.Forms.Screen.FromHandle(windowInteropHelper.Handle);
            ScreenService wpfScreen = new ScreenService(screen);

            return(wpfScreen);
        }
コード例 #2
0
ファイル: ScreenService.cs プロジェクト: Jon2G/Xamarin.Tools
        public static ScreenService 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);
            Screen        screen    = System.Windows.Forms.Screen.FromPoint(drawingPoint);
            ScreenService wpfScreen = new ScreenService(screen);

            return(wpfScreen);
        }