更新整理
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
|
||||
|
||||
|
||||
namespace WPFluent.Hardware;
|
||||
namespace WPFluent.Hardware;
|
||||
|
||||
/// <summary>
|
||||
/// Stores DPI information from which a <see cref="System.Windows.Media.Visual"/> or <see
|
||||
|
||||
@@ -31,7 +31,7 @@ internal static class DpiHelper
|
||||
nint hdc = User32.GetDC(0);
|
||||
float scaleX = Gdi32.GetDeviceCaps(hdc, Gdi32.DeviceCap.LOGPIXELSX);
|
||||
float scaleY = Gdi32.GetDeviceCaps(hdc, Gdi32.DeviceCap.LOGPIXELSY);
|
||||
_ = User32.ReleaseDC(IntPtr.Zero, hdc);
|
||||
User32.ReleaseDC(IntPtr.Zero, hdc);
|
||||
return new(scaleX / 96f, scaleY / 96f);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ internal static class DpiHelper
|
||||
/// <param name="windowHandle">Handle of the window that you want to get information about.</param>
|
||||
public static DisplayDpi GetWindowDpi(IntPtr windowHandle)
|
||||
{
|
||||
if (windowHandle == IntPtr.Zero || !UnsafeNativeMethods.IsValidWindow(windowHandle))
|
||||
if (windowHandle == IntPtr.Zero/* || !UnsafeNativeMethods.IsValidWindow(windowHandle)*/)
|
||||
{
|
||||
return new DisplayDpi(DefaultDpi, DefaultDpi);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user