[Windows 10] DPI Scaling madness on High Resolution Monitors

Summary

When using Windows 10 on a high resolution monitor applications do not scale correctly.

Issue

You will find that the text boxes scale fine but control buttons seem to become malformed.

An example this can be seen below where checkbox and drop down menus are not correctly

VMWareVsphee_ScalingIssue

Resolution

There are a couple of options available since Windows Vista regarding display scaling.

Option 1:

Disable Scaling: This is a bit of a hammer approach; while the application will display correctly on a high resolution monitor everything will appear very small.

Option 2:

XPS style DPI Scaling: This uses the operating system defined scaling factors. As a result depending on the application you ended up seeing the application exhibit odd behaviour.

Option 3:

Bitmap Scaling: This draws the graphical components in an off-screen buffer and then re-draws them on the screen. Obviously this is somewhat more resource intensive so it is understandable why the previous option was adopted by default. Using bitmap scaling however seems to yield better results.

Implementation

1) Enable Bitmap scaling by setting the following registry key

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide]
"PreferExternalManifest"=dword:00000001

2) Windows needs to be told which applications you would like to scale using Bitmap scaling. This is achieved by creating a manifest file for each application exe.

  1. Open your favourite UTF8 text editor (for example notepad)
  2. Paste the following text into the editor
    SSMS in High-DPI Displays: How to Stop the Madness | spaghettidba

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    <dependency>
      <dependentAssembly>
        <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*">
        </assemblyIdentity>
      </dependentAssembly>
    </dependency>
    <dependency>
      <dependentAssembly>
        <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b">
        </assemblyIdentity>
      </dependentAssembly>
    </dependency>
    
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
      <security>
        <requestedPrivileges>
          <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
        </requestedPrivileges>
      </security>
    </trustInfo>
    
    <asmv3:application>
      <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
        <ms_windowsSettings:dpiAware xmlns:ms_windowsSettings="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</ms_windowsSettings:dpiAware>
      </asmv3:windowsSettings>
    </asmv3:application>
    </assembly>
  3. Save the file as
    .exe.manifest
    e.g. VpxClient.exe.manifest
    a. Filename: VpxClient.exe.manifest
    b. Save as type: All Files
    c. Encoding: UTF-8
     vmwarevsphee_scalingissue_savefile
  4. Place the file in the same directory as the application exe

Credit for this fix goes entirely to Gianluca Sartori and his excellent blog post here:
https://spaghettidba.com/2015/10/14/ssms-in-high-dpi-displays-how-to-stop-the-madness/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s