我无法让我的应用程序感知 DPI。在 app.manifest 我未注释:
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
在 App.config 我添加:
<appSettings>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
</appSettings>
我正在关注 使 vb.net 应用程序 DPI 感知 和 https://www.telerik.com/blogs/winforms-scaling-at-large-dpi-settings-is-it-even-possible-中的问题和回答
我的应用程序有一个带有单个用户控件的表单。在每次我尝试使用 AutoScaleMode 运行应用程序到各种设置:无、Dpi、字体、继承(它们默认为字体)。我在笔记本电脑上使用的是原厂原装显示器。
在每种情况下,e.graphics.dpix 和 e.graphics.dpiy(其中 e 是 PaintEventArgs)都是 96.0。它应该是 128.0 = 1920 像素 / 15 英寸和 128.0 = 1080 / 8.4375 英寸。
我错过了什么?