private float CalcScale() { using (var g = Graphics.FromHwnd(IntPtr.Zero)) { IntPtr desktop = g.GetHdc(); int logicalScreenHeight = WindowNative.GetDeviceCaps(desktop, (int)WindowNative.DeviceCap.VERTRES); int physicalScreenHeight = WindowNative.GetDeviceCaps(desktop, (int)WindowNative.DeviceCap.DESKTOPVERTRES); return((float)physicalScreenHeight / logicalScreenHeight); } }