4

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

The setting comes from Control Panel\Appearance and Personalization\Display ...

1

2 Answers 2

3

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

1
  • I was abl to get the correct value using HKEY_CURRENT_USER\Control Panel\Desktop\LogPixels. The value is 96 when using 100% and 120 when using 125%. Thanks! May 23, 2010 at 14:46
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.