コード例 #1
0
            static void GetDpi(Int32 x, Int32 y, MONITOR_DPI_TYPE dpiType, out UInt32 dpiX, out UInt32 dpiY)
            {
                var    point = new System.Drawing.Point(x + 1, y + 1);
                IntPtr mon   = MonitorFromPoint(point, MONITOR_POINT.MONITOR_DEFAULTTONEAREST);

                GetDpiForMonitor(mon, dpiType, out dpiX, out dpiY);
            }
コード例 #2
0
ファイル: Shcore.cs プロジェクト: decay88/CommonWin32
 /// <summary>
 /// Queries the dots per inch (dpi) of a display.
 /// </summary>
 /// <param name="hmonitor">Handle of the monitor being queried.</param>
 /// <param name="dpiType">The type of DPI being queried</param>
 /// <returns>The value of the DPI.</returns>
 public static int GetDpiForMonitor(IntPtr hmonitor, MONITOR_DPI_TYPE dpiType = MONITOR_DPI_TYPE.MDT_DEFAULT)
 {
     if (IsPlatformSupported)
     {
         uint dpiX = 0;
         uint dpiY = 0;
         if (NativeMethods.GetDpiForMonitor(hmonitor, dpiType, ref dpiX, ref dpiY).Succeeded)
         {
             return((int)dpiX);
         }
     }
     return(DefaultDPI);
 }
コード例 #3
0
ファイル: Shcore.cs プロジェクト: tangwen831183/CommonWin32
 /// <summary>
 /// Queries the dots per inch (dpi) of a display.
 /// </summary>
 /// <param name="hmonitor">Handle of the monitor being queried.</param>
 /// <param name="dpiType">The type of DPI being queried</param>
 /// <returns>The value of the DPI.</returns>
 public static int GetDpiForMonitor(IntPtr hmonitor, MONITOR_DPI_TYPE dpiType = MONITOR_DPI_TYPE.MDT_DEFAULT)
 {
     if (IsPlatformSupported)
     {
         uint dpiX = 0;
         uint dpiY = 0;
         if (NativeMethods.GetDpiForMonitor(hmonitor, dpiType, ref dpiX, ref dpiY).Succeeded)
         {
             return (int)dpiX;
         }
     }
     return DefaultDPI;
 }
コード例 #4
0
 public static extern int GetDpiForMonitor(
     IntPtr hmonitor,
     MONITOR_DPI_TYPE dpiType,
     ref uint dpiX,
     ref uint dpiY);
コード例 #5
0
 private static extern int GetDpiForMonitor(
     IntPtr hmonitor,
     MONITOR_DPI_TYPE dpiType,
     out uint dpiX,
     out uint dpiY);
コード例 #6
0
 public static extern HResult GetDpiForMonitor(IntPtr hmonitor, MONITOR_DPI_TYPE dpiType, out int dpiX, out int dpiY);
コード例 #7
0
ファイル: Shcore.cs プロジェクト: decay88/CommonWin32
        /// <summary>
        /// Queries the dots per inch (dpi) of a display containing a window.
        /// </summary>
        /// <param name="hWnd">Handle of the window.</param>
        /// <param name="dpiType">The type of DPI being queried</param>
        /// <returns>The value of the DPI.</returns>
        public static int GetDpiForWindow(IntPtr hWnd, MONITOR_DPI_TYPE dpiType = MONITOR_DPI_TYPE.MDT_DEFAULT)
        {
            var hmonitor = User32.MonitorFromWindow(hWnd, MonitorOption.MONITOR_DEFAULTTONEAREST);

            return(GetDpiForMonitor(hmonitor, dpiType));
        }
コード例 #8
0
ファイル: DPIWrapper.cs プロジェクト: fengjixuchui/NWSRMgr
 private static extern long GetDpiForMonitor(
     IntPtr hmonitor,
     MONITOR_DPI_TYPE dpiType,
     ref uint dpiX,
     ref uint dpiY);
コード例 #9
0
 private static extern int GetDpiForMonitor([In] IntPtr hmonitor, [In] MONITOR_DPI_TYPE dpiType, [Out] out uint dpiX, [Out] out uint dpiY);
コード例 #10
0
 internal static extern IntPtr GetDpiForMonitor(IntPtr hMonitor, MONITOR_DPI_TYPE dpiType, ref UInt32 dpiX, ref UInt32 dpiY);
コード例 #11
0
ファイル: Shcore.cs プロジェクト: tangwen831183/CommonWin32
 /// <summary>
 /// Queries the dots per inch (dpi) of a display containing a window.
 /// </summary>
 /// <param name="hWnd">Handle of the window.</param>
 /// <param name="dpiType">The type of DPI being queried</param>
 /// <returns>The value of the DPI.</returns>
 public static int GetDpiForWindow(IntPtr hWnd, MONITOR_DPI_TYPE dpiType = MONITOR_DPI_TYPE.MDT_DEFAULT)
 {
     var hmonitor = User32.MonitorFromWindow(hWnd, MonitorOption.MONITOR_DEFAULTTONEAREST);
     return GetDpiForMonitor(hmonitor, dpiType);
 }
コード例 #12
0
ファイル: Shcore.cs プロジェクト: tangwen831183/CommonWin32
 public static extern HRESULT GetDpiForMonitor(IntPtr hmonitor, MONITOR_DPI_TYPE dpiType, ref uint dpiX, ref uint dpiY);
コード例 #13
0
 public static extern void GetDpiForMonitor(IntPtr hMonitor, MONITOR_DPI_TYPE dpiType, out int dpiX, out int dpiY);
コード例 #14
0
 internal static extern uint GetDpiForMonitor(HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, out uint dpiX, out uint dpiY);
コード例 #15
0
 internal static extern HRESULT GetDpiForMonitor(IntPtr hmonitor, MONITOR_DPI_TYPE dpiType, out UInt32 dpiX, out UInt32 dpiY);
コード例 #16
0
 public static extern long GetDpiForMonitor(IntPtr hmonitor, MONITOR_DPI_TYPE dpiType, out uint dpiX, out uint dpiY);
コード例 #17
0
 static extern IntPtr GetDpiForMonitor([In] IntPtr hmonitor, [In] MONITOR_DPI_TYPE dpiType, [Out] out UInt32 dpiX, [Out] out UInt32 dpiY);
コード例 #18
0
 public static extern HRESULT GetDpiForMonitor(HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, out uint dpiX, out uint dpiY);
コード例 #19
0
 public static extern long GetDpiForMonitor(IntPtr hmonitor, MONITOR_DPI_TYPE dpiType, out uint dpiX, out uint dpiY);
コード例 #20
0
ファイル: SHCore.cs プロジェクト: jmelosegui/pinvoke
 public static extern HResult GetDpiForMonitor(IntPtr hmonitor, MONITOR_DPI_TYPE dpiType, out int dpiX, out int dpiY);