Detect Display DPI Settings on Windows and possibly on mac

  1. 2 months ago

    Aurelian N

    Sep 11 Pre-Release Testers, Xojo Pro

    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.

  2. Joost R

    Sep 12 Pre-Release Testers, Xojo Pro The Netherlands

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

  3. Aurelian N

    Sep 12 Pre-Release Testers, Xojo Pro

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

    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 .

  4. Greg O

    Sep 12 Xojo Inc Somewhere near Raleigh, NC
    Edited 2 months ago

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

    dim sf as double = self.ScaleFactor

or Sign Up to reply!