How to get Windows 10 display scaling value using C# (Note: not the DPI value)

Steven Young 261 Reputation points
2021-09-02T08:21:00.547+00:00

In the display settings of Windows 10, you can set the scaling ratio (for example: 125%, 150%). Please note that it is not the DPI value. How to get this value using C#.

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,863 questions
Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,937 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,479 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 82,321 Reputation points
    2021-09-02T09:08:12.363+00:00

    For example with GetDpiForWindow

    with a Manifest to get right results:

       <application xmlns="urn:schemas-microsoft-com:asm.v3">  
         <windowsSettings>  
           <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>  
           <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>  
          </windowsSettings>  
       </application>  
    

    I get :
    96 for 100%
    120 for 125%
    144 for 150%
    etc...

    1 person found this answer helpful.
    0 comments No comments