简体   繁体   English

屏幕文本大小,以.NET格式

[英]Screen Text size in .NET

Is there a way to know if the text size is at 125% from .NET/C#? 有没有办法知道.NET / C#的文本大小是否为125%?

The setting comes from Control Panel\\Appearance and Personalization\\Display ... 该设置来自控制面板\\外观和个性化\\显示...

I haven´t tried this my self. 我没试过这个我自己。

This registry key in windows pre Windows 7: Windows 7之前的Windows注册表项:
HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontDPI:LogPixels HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Microsoft \\ Windows NT \\ CurrentVersion \\ FontDPI:LogPixels

And this one in Windows 7: 而这个在Windows 7中:
HKEY_CURRENT_USER\\Control Panel\\Desktop:LogPixels HKEY_CURRENT_USER \\控制面板\\桌面:LogPixels

All according to this thread in MSDN Forum 所有根据MSDN论坛中的这个主题

Here is some additional resources: 这是一些额外的资源:
Creating a DPI-Aware Application 创建DPI感知应用程序
C# Scaling UserControl content to match users Dpi/Font Size C#缩放UserControl内容以匹配用户Dpi /字体大小
About DPI issue 关于DPI问题

I'm not sure but maybe you can just get the Dpi settings and check if they're 96 or not: 我不确定,但也许你可以获得Dpi设置并检查它们是否为96:

using(Graphics g = this.CreateGraphics())
{
    MessageBox.Show(g.DpiX.ToString() + Environment.NewLine + g.DpiY.ToString());
}

You might have to call SetProcessDPIAware first though. 您可能必须首先调用SetProcessDPIAware

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM