gpt4 book ai didi

c# - Windows 10 高 DPI 屏幕上的 WPF 应用程序模糊

转载 作者:行者123 更新时间:2023-11-30 20:19:09 25 4
gpt4 key购买 nike

WPF 应用程序是否通常开箱即用地在高 DPI 屏幕上正确缩放(无需进一步自定义 list 等?)。我的理解是他们这样做了?

当在笔记本电脑屏幕上查看时,我编写的两个 WPF 应用程序在我的新笔记本电脑(运行 Windows 10)上都显得模糊。通常笔记本电脑的主显示器设置为外部低 dpi 显示器,内置笔记本电脑面板缩放比例为 125%。但是,无论是否插入低 dpi 显示器,都会出现模糊。

我认为这可能与我的两个应用程序的启动方式有关(通过主要方法,而不是启动主窗口的默认代码模板),但我刚刚启动了 Visual Studio 2015 并生成了一个带有项目模板的全新 WPF 应用程序(空白表单上只有几个单选按钮),它也不会在我的系统上扩展到高 DPI。

可能还值得一提的是,我已经在我的 Windows 副本上配置了“首选外部 list ”注册表设置,以允许每个应用程序使用 list 禁用高 dpi 缩放。 (即 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide "PreferExternalManifest"=dword:00000001)。

最佳答案

.net 4.6.2 开头默认情况下,WPF 应用程序是每个监视器 DPI 感知的,而不是早期版本:

WPF applications are now enabled for per-monitor DPI awareness. This improvement is critical for scenarios where multiple displays of varying DPI level are attached to a single machine. As all or part of a WPF application is transitioned between monitors, the expected behavior is for WPF to automatically match the DPI of the app to the screen. It now does. In previous versions, you would have to write additional native code to enable per-monitor DPI awareness in WPF applications.

因此安装 .4.6.2 开发工具并将您的应用程序定位到 4.6.2 以获得对此的支持。

关于c# - Windows 10 高 DPI 屏幕上的 WPF 应用程序模糊,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39217355/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com