In a previous post we looked at OpenInsight’s new features for running on High-DPI systems, and we described how forms can properly scale themselves to take advantage of better resolutions, thereby avoiding unnecessary blurring as the window manager tries to compensate when faced with a non-DPI-aware application:
In the example above both forms are running on a desktop set to 144 DPI (150%). The top form is running under OpenInsight v9 and, as you can see, has been stretched by the system resulting in blurry outlines, icons and text. In contrast, the bottom form is running under OpenInsight v10 and has been scaled correctly – the checkbox image and icon are sharp and the font has been scaled to the correct point size. (A word of caution – if your own system is set to use High-DPI don’t bother viewing this image on a Chrome-based browser unless you’ve set _it_ to use High-DPI as well – generally Chrome doesn’t handle automatic High DPI scaling like IE and FF, so the image above will still appear blurry, as will this text!).
However, with the release of Windows 8.1 Microsoft have made some significant changes in this area that has also led to changes in OpenInsight’s High-DPI handling as well. Until Windows 8.1 the DPI setting for the system was constant across all monitors and fixed during the login process – selecting another DPI setting required logging out and back in again, or even a full reboot in the case of Windows XP. Now, with the steady increase in monitor resolutions across different form factors, Microsoft have added the ability to set the DPI per monitor, which means that forms created on one monitor may look too small or too big when moved to another monitor with a different DPI.
In order to deal with this at runtime, top-level forms are now notified by a new Windows message called WM_DPICHANGED, which is sent when either of the following happens:
- The DPI of the monitor a form is displayed on changes, or
- The form is moved between monitors that have different DPI settings.
This message is used by OpenInsight to adjust the scale of a form dynamically as required, so if a form’s DPISCALING property is TRUE you will see this happen as you drag it across monitors with different DPIs. All the rules described in the original post still apply of course:
- Fonts are scaled
- Coordinates are scaled
- DPI-aware images are selected and/or scaled
(We’ve also added a new property called DPI to the WINDOW object, which returns the DPI of the monitor that the window is currently displayed on).
The fact that scaling has moved from a static to a dynamic operation has also led to the implementation of a new OpenInsight WINDOW property called SCALEFACTOR, which allows you to set the scale of a form to an arbitrary value at runtime, regardless of any DPI setting. We’ll take a look at this property in the next post.
In the meantime, you can find more information on Windows 8.1 per-monitor DPI scaling here:
- Windows 8.1DPI Scaling Enhancements
- High DPI for desktop apps in Windows 8.1
- High DPI Support for IT Professionals
- Making your Desktop Apps Shine on High-DPI Displays (video – Build 2013)
(Disclaimer: This article is based on preliminary information and may be subject to change in the final release version of OpenInsight 10).