Beispiel #1
0
        public void GetScreenDpi(ScreenInfo screen, ScreenInterop.DpiType dpiType, out uint dpiX, out uint dpiY)
        {
            var point   = new Point(screen.Left + 1, screen.Top + 1);
            var monitor = ScreenInterop.MonitorFromPoint(point, ScreenInterop.MONITOR_DEFAULTTONEAREST);

            ScreenInterop.GetDpiForMonitor(monitor, dpiType, out dpiX, out dpiY);
        }
        /// <summary>
        /// Will return an instance of NavigatorInterop that'll give access to window.navigator API
        /// </summary>
        /// <value></value>
        public async Task <ScreenInterop> Screen()
        {
            ScreenInterop screeninterop = await jsRuntime.GetInstancePropertyAsync <ScreenInterop>(JsRuntimeObjectRef, "screen");

            screeninterop.SetJSRuntime(jsRuntime, this.JsRuntimeObjectRef);
            return(screeninterop);
        }
Beispiel #3
0
        protected ScreenInfo GetScreenInfo(IntPtr monitor)
        {
            var monitorInfo = new ScreenInterop.NativeMonitorInfo();

            ScreenInterop.GetMonitorInfo(monitor, monitorInfo);

            var left   = monitorInfo.Monitor.Left;
            var top    = monitorInfo.Monitor.Top;
            var width  = (monitorInfo.Monitor.Right - monitorInfo.Monitor.Left);
            var height = (monitorInfo.Monitor.Bottom - monitorInfo.Monitor.Top);

            return(new ScreenInfo(left, top, width, height));
        }
Beispiel #4
0
        public bool TryGetScreenInfo(int pointLeft, int pointTop, out ScreenInfo screenInfo)
        {
            var point   = new Point(pointLeft, pointTop);
            var monitor = ScreenInterop.MonitorFromPoint(point, ScreenInterop.MONITOR_DEFAULTTONEAREST);

            if (monitor != IntPtr.Zero)
            {
                screenInfo = GetScreenInfo(monitor);
                return(true);
            }

            screenInfo = ScreenInfo.Empty;
            return(false);
        }