mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
Fix for BUG-2851, Windows 7 doesn't have the used API yet.
This commit is contained in:
parent
ce56ee1cb6
commit
24d4e926ad
1 changed files with 6 additions and 2 deletions
|
@ -114,6 +114,10 @@ namespace Greenshot.Base.Core
|
|||
/// <returns>uint</returns>
|
||||
public static uint GetDpi(POINT location)
|
||||
{
|
||||
if (!WindowsVersion.IsWindows81OrLater)
|
||||
{
|
||||
return DefaultScreenDpi;
|
||||
}
|
||||
RECT rect = new RECT(location.X, location.Y, 1, 1);
|
||||
IntPtr hMonitor = User32.MonitorFromRect(ref rect, User32.MONITOR_DEFAULTTONEAREST);
|
||||
var result = GetDpiForMonitor(hMonitor, MonitorDpiType.EffectiveDpi, out var dpiX, out var dpiY);
|
||||
|
@ -172,7 +176,7 @@ namespace Greenshot.Base.Core
|
|||
/// </summary>
|
||||
/// <param name="hWnd">IntPtr</param>
|
||||
/// <returns>uint with dpi</returns>
|
||||
[DllImport("User32.dll")]
|
||||
[DllImport("user32.dll")]
|
||||
private static extern uint GetDpiForWindow(IntPtr hWnd);
|
||||
|
||||
/// <summary>
|
||||
|
@ -193,7 +197,7 @@ namespace Greenshot.Base.Core
|
|||
/// Returns the system DPI.
|
||||
/// </summary>
|
||||
/// <returns>uint with the system DPI</returns>
|
||||
[DllImport("User32.dll")]
|
||||
[DllImport("user32.dll")]
|
||||
private static extern uint GetDpiForSystem();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue