tags:

views:

100

answers:

2

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 ...

+2  A: 

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
http://stackoverflow.com/questions/572820
http://stackoverflow.com/questions/572270

Jens Granlund
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!
Curchy
A: 

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.

ho1