简体   繁体   English

如何使我的应用程序能够感知DPI?

[英]How to make my application DPI-aware?

When a user sets the DPI scaling to draw fonts and windows larger in all displays, I don't want my application to be affected (I don't want my application's fonts and controls get larger) 当用户设置DPI缩放比例以在所有显示中绘制更大的字体和窗口时,我不希望我的应用程序受到影响(我不希望我的应用程序的字体和控件变大)

I tried to use SetProcessDPIAware() function or add a manifest file, but it didn't work. 我试图使用SetProcessDPIAware()函数或添加清单文件,但是没有用。 How can I prevent windows (XP, 7 and 8) to change my application's font size? 如何防止Windows(XP,7和8)更改应用程序的字体大小?

You're asking the wrong question. 您问错了问题。 You want it to be DPI-independent. 您希望它独立于DPI。 The answer is to size everything in points, and everything relative to that in ems. 答案是按磅计算所有内容,以及相对于ems的所有内容。 Avoid DPI and pixels completely. 完全避免DPI和像素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何创建与Windows 7向后兼容的缩放和大小更改Per-Monitor DPI感知应用程序? - How to create a scaling and size-changing Per-Monitor DPI-aware application that is backwards compatible with Windows 7? 每个监视器DPI-Aware:使用NVIDIA Optimus的黑色窗口故障 - Per-monitor DPI-Aware: black window glitch with NVIDIA Optimus 如何在DPI识别的获胜应用程序上缩放标题栏? - How do you scale the title bar on a DPI aware win application? 如何开发新的Qt 5.7+ High-DPI Per Monitor DPI Aware应用程序? - How to approach development of new Qt 5.7+ High-DPI Per Monitor DPI Aware application? 如何使 MFC CToolbar 按钮大小对于 Windows 7/10 上的高 DPI 感知应用程序更加一致 - How to make MFC CToolbar button sizes more consistent for high DPI aware applications on Windows 7/10 如何使应用程序大地址感知? - What to do to make application Large Address Aware? 检查Windows 7上是否有其他进程可识别DPI - Check if another process is DPI aware on Windows 7 SetWindowPos()跨进程DPI感知 - SetWindowPos() cross-process DPI aware 如何让 Scons 中的 SConscript 知道 header 位置? - How to make a SConscript in Scons aware of a header location? 使用 Windows API 调整屏幕大小时,DPI 感知会扭曲文本 - DPI aware distorts text when screen resized with Windows API
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM