Detect Display DPI Settings on Windows and possibly on mac

Hello Guys ,

Is there a way to detect the DPI of the interface ? i noticed on most of the windows machines the interface is set to (125 % ) Scale factor , me i keep it on 100 % and i designed the interface for that , being a fixed interface size it will mess the Windows tab panel buttons as i had to do some custom spacing so that it fixes properly the buttons. If i had that data then i could do some calculations and update the interface properly with forcing the users to move the scale to Smaller (100%).

Screen size DPI can be found on Windows on Control Panel -> Display -> Set custom size (DPI)

On mac Settings -> Display -> Resolution and it`s similar .

Thanks.

Settings are stored in the Windows Registry, so you could consider reading from the registry by code.
Some sites explain how to fix DPI issues straight into the registry, so it must be possible to find what you need.

[quote=349896:@Joost Rongen]Settings are stored in the Windows Registry, so you could consider reading from the registry by code.
Some sites explain how to fix DPI issues straight into the registry, so it must be possible to find what you need.[/quote]
Thanks ,

It seems that in my case is found on HKEY_CURRENT_USER/Control Panel/Desktop/WindowsMetrics/AppliedDPI, so indeed i could have a look here and do some calculations according to that .

If you build a HiDPI app for Windows, you can use the following code in a window:

dim sf as double = self.ScaleFactor