开发者

Screen Text size in .NET

Is there a way to know if the text size is at 125% from .NET/C#?

The setting comes from Control Panel\Appearanc开发者_高级运维e and Personalization\Display ...


I haven´t tried this my self.

This registry key in windows pre Windows 7:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontDPI:LogPixels

And this one in Windows 7:
HKEY_CURRENT_USER\Control Panel\Desktop:LogPixels

All according to this thread in MSDN Forum

Here is some additional resources:
Creating a DPI-Aware Application
C# Scaling UserControl content to match users Dpi/Font Size
About DPI issue


I'm not sure but maybe you can just get the Dpi settings and check if they're 96 or not:

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

You might have to call SetProcessDPIAware first though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜