【发布时间】:2017-01-19 08:58:48
【问题描述】:
据我们所知,Windows 7 可用的 DPI 缩放比例为 100%、125%、150% 和 200%。 这四个 DPI 百分比的实际 DPI 值为
Percentage - DPI Values
100% - 96
125% - 120
150% - 144
200% - 192
参考 DPI 缩放的链接: http://www.techrepublic.com/blog/windows-and-office/get-a-better-view-in-windows-7-by-adjusting-dpi-scaling/
使用 C# 我想获取 DPI 值。所以通过遵循 C# 代码我试图实现。
float x=0;
float y=0;
Graphics gp = Graphics.FromHwnd(IntPtr.Zero);// we can also use this.CreateGraphics()
x = gp.DpiX;
y = gp.DpiY;
得到如下输出,150% 和 200% 是错误的
100% - 96 //both x,y values
125% - 120 //both x,y values
**150% - 96 //both x,y values
200% - 96 //both x,y values**
【问题讨论】: