C++ Windows API - 如何检索字体缩放百分比 [英] C++ Windows API - How to retrieve font scaling percentage

查看:55
本文介绍了C++ Windows API - 如何检索字体缩放百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 C++ Windows API 应用程序中检索 使文本更大" 百分比.我知道如何检索缩放 (DPI) 因子,但我还想包括字体缩放百分比(请参阅附图,上限值,而不是下限值).

I want to retrieve the "Make text bigger" percentage in C++ Windows API application. I know how to retrieve the scaling (DPI) factor, but I also want to include the font scaling percentage (see the attached image, the upper value, not the lower one).

最终,我想制作保留用户字体和 DPI 缩放设置的应用程序,以完全支持辅助功能.目前,字体在 .rc 文件中指定,如下所示

Ultimately, I want to make application that preserves user font and DPI scaling settings in order to fully support accessibility features. Currently, the font is specified in .rc file like so

FONT 8, "MS Shell Dlg 2", 0, 0, 0x0

但是即使省略了 FONT 语句,在更改使文本更大"时字体仍然不会改变设置.

but even omitting the FONT statement, the font still does not change when changing "Make text bigger" setting.

推荐答案

为了让一切变得更大";部分,您可以使用 GetScaleFactorForMonitor

For the "Make everything bigger" section, you can use GetScaleFactorForMonitor

获取特定显示器的比例因子.

Gets the scale factor of a specific monitor.

对于使文本更大"部分,您可以使用 WinRT 静态属性:UISettings.TextScaleFactor

For the "Make text bigger" section, you can use a WinRT static property: UISettings.TextScaleFactor

获取系统文字大小设置的值.

Gets the value of the system text size setting.

否则也可以使用 TextScaleFactor 读取后者HKEY_CURRENT_USER\SOFTWARE\Microsoft\Accessibility 注册表项中的 DWORD 属性(但未正式记录).

Otherwise the latter can also be read using the TextScaleFactor DWORD attribute in the HKEY_CURRENT_USER\SOFTWARE\Microsoft\Accessibility registry key (but this is not officially documented).

这篇关于C++ Windows API - 如何检索字体缩放百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆