Paul
Paul

Reputation: 1059

Reading Windows Display settings

Under Control Panel > Display a user can select Smaller/Medium/Larger for changing the size of various display elements in Windows. In my windows form app how can I detect the currently selected value?

I've tried searching but most of the answers are along the line of measuring DPI:

float dpiX, dpiY;
Graphics graphics = this.CreateGraphics();
dpiX = graphics.DpiX;
dpiY = graphics.DpiY;

Which returns 96/120/96 respectively for the 3 settings, and in any case is there really no way just tell which of these 3 radio settings a user has selected?

Upvotes: 1

Views: 71

Answers (1)

Maciej Pulikowski
Maciej Pulikowski

Reputation: 2517

You can use a registry to detect this.

HKEY_CURRENT_USER\Control Panel\Desktop

LogPixels attribute change every time, when i'm switching options in Display.

100% - 96

125% - 120

150% - 144

But i'm not sure if values will be same on every monitor and resolution. You need to check it.

Upvotes: 1

Related Questions