mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
Use effective pixels for unsupported previewer (#26345)
This commit is contained in:
@@ -58,5 +58,12 @@ namespace Peek.UI.Extensions
|
||||
PInvoke.GetMonitorInfo(monitor, ref info);
|
||||
return new Size(info.rcMonitor.Size.Width, info.rcMonitor.Size.Height);
|
||||
}
|
||||
|
||||
internal static double GetMonitorScale(this HWND hwnd)
|
||||
{
|
||||
var dpi = PInvoke.GetDpiForWindow(hwnd);
|
||||
var scalingFactor = dpi / 96d;
|
||||
return scalingFactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,7 @@ namespace Peek.UI.Extensions
|
||||
public static double GetMonitorScale(this Window window)
|
||||
{
|
||||
var hwnd = new HWND(window.GetWindowHandle());
|
||||
var dpi = PInvoke.GetDpiForWindow(new HWND(hwnd));
|
||||
double scalingFactor = dpi / 96d;
|
||||
|
||||
return scalingFactor;
|
||||
return hwnd.GetMonitorScale();
|
||||
}
|
||||
|
||||
public static void BringToForeground(this Window window)
|
||||
|
||||
Reference in New Issue
Block a user