public static IntPtr GetHMonitor(this Rectangle rect, MonitorDefaultTo defaultTo = MonitorDefaultTo.Nearest)
        {
            var nativeRect = new NativeRect()
            {
                Left   = rect.Left,
                Top    = rect.Top,
                Right  = rect.Right,
                Bottom = rect.Bottom,
            };

            return(MonitorFromRect(ref nativeRect, defaultTo));
        }
		public static Dpi GetMonitorDpi(this HwndSource hwndSource,
			MonitorDefaultTo defaultTo = MonitorDefaultTo.Nearest,
			MonitorDpiType dpiType = MonitorDpiType.Default)
		{
			var hmonitor = NativeMethods.MonitorFromWindow(
				hwndSource.Handle,
				defaultTo);

			uint dpiX = 1, dpiY = 1;
			NativeMethods.GetDpiForMonitor(hmonitor, dpiType, ref dpiX, ref dpiY);

			return new Dpi((ushort)dpiX, (ushort)dpiY);
		}
Exemple #3
0
 private static extern IntPtr MonitorFromPoint(Point pt, MonitorDefaultTo dwFlags);
Exemple #4
0
 public static extern IntPtr MonitorFromWindow(IntPtr hwnd, MonitorDefaultTo dwFlags);
Exemple #5
0
 internal static extern IntPtr MonitorFromWindow(IntPtr hWnd, MonitorDefaultTo dwFlags);
 public static extern IntPtr MonitorFromWindow(IntPtr hwnd, MonitorDefaultTo dwFlags);
Exemple #7
0
 private static extern IntPtr MonitorFromPoint(Point pt, MonitorDefaultTo dwFlags);
 private static extern IntPtr MonitorFromRect([In] ref NativeRect lprc, [In] MonitorDefaultTo dwFlags);
 private static extern IntPtr MonitorFromWindow([In] IntPtr hwnd, [In] MonitorDefaultTo dwFlags);
Exemple #10
0
 public static extern IntPtr  MonitorFromPoint(System.Drawing.Point pt, MonitorDefaultTo dwFlags);
Exemple #11
0
 public static extern IntPtr MonitorFromRect(ref RECT lpRect, MonitorDefaultTo dwFlags);
Exemple #12
0
 public static extern IntPtr MonitorFromPoint(POINT pt, MonitorDefaultTo dwFlags);