top of page
Search
ratiretsejecap

DPI scaling improvements in Windows 10: A guide for better display quality



Use UWP applicationsUse or deploy Universal Windows Platform (UWP) applications instead of Win32 applications.Modern (UWP) apps always scale correctly. If there is a comparable modern app available, you can substitute that app to mitigate the scaling issues. For example, Edge is a modern app that does not cause the DPI Scaling issues that Internet Explorer might experience. Similarly, Remote Desktop is an alternative to mstsc.exe.


Adjust display settingsWindows 10Select Display > Change the size of text, apps, and other items, and then adjust the slider for each monitor.Earlier Windows systemsRight-click the application, select Properties, select the Compatibility tab, and then select the Disable display scaling on high DPI settings check box.




DPI scaling improvements in Windows 10



Change application propertiesIn Explorer or on the Start menu, right-click the application name, select Properties, select the Compatibility tab, and then select the Disable display scaling on high DPI settings check box.


In the previous blog post about High-dots-per-inch (DPI) scaling improvements, we talk about how desktop applications can be blurry or sized incorrectly when run on high-DPI displays. This is especially noticeable when docking and undocking or when using remoting technologies such as Remote Desktop Protocol (RDP).


The Anniversary Update introduced the concept of mixed-mode DPI scaling which let you have different DPI-awareness contexts (modes) for each top-level window within a process, and these contexts could be different than the process-wide default. This enabled you to ease in to the world of per-monitor scaling by focusing on the parts of the UI that matter the most while letting Windows handle bitmap stretching other top-level windows. In the Creators Update we added a new awareness context, (DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) which we refer to as per-monitor version 2 (PMv2).


PMv2 is technically a DPI_AWARENESS_CONTEXT and not one of the process-wide DPI awareness modes defined in the PROCESS_DPI_AWARENESS enumeration. PMv2 is designed to provide per-monitor scaling functionality that is missing from the original implementation of per-monitor awareness. This context enables the following:


With these APIs you can opt a specific window in a dialog (or the entire dialog itself) out of DPI scaling functionality. When your dialog is DPI scaled by the system a new font is sent to all HWNDs in the dialog. You might, for example, want to opt out of having Windows send a DPI-scaled font to a specific HWND. You could use SetDialogControlDpiChangeBehavior in this case.


Per-Monitor DPI awareness support was first introduced in Windows 8.1 but many in-box Windows applications did not properly adopt this DPI scaling model. One of the most notable offenders was Internet Explorer. In the Creators Update IE has been updated to dynamically DPI scale.


The most basic setting to look at is display scaling, which essentially means adjusting the DPI by some percentage multiplier. By increasing the display scaling, you can make on-screen items such as text and icons more substantial and more comfortable to read and use.


For example, here is the same 4K UHD display and settings app at 250% scaling (click on the image to see it clearly in full resolution). All the on-screen items such as text and icons are now much easier to view and manipulate.


When looking for new apps for Windows 10, try to make sure they are Universal Windows Platform (UWP) apps. UWP has built-in scaling that takes advantage of your screen size to give you the best graphics without leaving you struggling to access certain areas of the screen.


SetThreadDpiAwarenessContext enables the use of different DPI scaling modes within a single process. Prior to the Windows 10 Anniversary Update, a window s DPI awareness was bound to the process-wide DPI awareness mode (DPI unaware, System DPI aware, or Per-Monitor DPI aware). But now, with SetThreadDpiAwarenessContext, top-level windows can have a DPI awareness mode that is different than that of the process-wide DPI awareness mode. This also effects child windows, as they will always have the same DPI awareness mode as their parent window.


The use of SetThreadDpiAwarenessContext enables developers to decide where they want to focus their development efforts when defining DPI-specific behavior for desktop applications. For example, an application's primary top-level window could be scaled on a per-monitor basis while secondary top-level windows could be scaled via bitmap-scaling by the operating system.


A common scenario for the use of SetThreadDpiAwarenessContext is as follows: Begin with a thread that is running with one context (such as DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE) temporarily switch to a different context (DPI_AWARENESS_CONTEXT_UNAWARE), create a window, and then immediately switch the thread context back to its previous state. The created window will have a DPI context of DPI_AWARENESS_CONTEXT_UNAWARE, while the calling thread s context will be restored to DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE with a subsequent call to SetThreadDpiAwarenessContext. In this scenario, the window associated with the calling thread would run with a per-monitor context (and therefore not be bitmap-stretched by the operating system) while the newly-created window would not be DPI aware (and therefore would be automatically bitmap stretched on a display set to >100% scaling).


Calling EnableNonClientDpiScaling from within a window s WM_NCCREATE handler will result in the non-client area of a top-level window automatically scaling for DPI. If the top-level window is per-monitor DPI-aware (whether because the process itself is per-monitor DPI-aware or because the window was created within a per-monitor DPI-aware thread), the caption bar, scroll bars, menus, and menu bars of these windows will DPI-scale whenever the window s DPI changes.


Nowadays, you'll find high-DPI displays on almost any device, including on phones, laptops, tablets, and on desktop computers. However, there is one problem, while Windows 10 ships with DPI scaling support to improve the viewing experience, legacy applications never really benefit from it.


You can see this scaling problem when running traditional desktop (win32) apps, where text and visual elements look blurry or they're sized incorrectly. To address this issue, Microsoft introduced some improvements with the Windows 10 Anniversary Update, but it wasn't until the Creators Update that we've seen significant changes.


Microsoft is improving the way Windows 10 handles automatic scaling per-monitor, which reduces the amount of blur or incorrect size for legacy apps. However, there are scenarios where applications won't render correctly, such as when a developer doesn't update an app to support new DPI scaling changes. For this and other similar situations, Windows 10 now includes an option to force a particular app to run as a DPI-unware process.


Once you've completed the steps, restart the application to see the improvements. If the new scaling option works as expected, text and visual elements should look crisper. (Note that you may also need to reboot your computer to see the changes.)


However, even with these limitations, the new high DPI scaling improvements are very noticeable to the point that Microsoft decided to enable the new option on many apps built into the OS, including the Microsoft Management Console (mmc.exe). This means that on the Creators Update and later versions built-in snap-in, such as Disk Management, Computer Management, Device Manager, and others will look significantly crispier and less blurry.


The new DPI scaling settings are only available for traditional desktop (GDI-based) apps. Windows Store apps cannot be configured with these options because they're already optimized for high pixel density displays.


Setting the DpiAwareness value to PerMonitorV2 enables all high DPI awareness features supported by .NET Framework versions starting with the .NET Framework 4.7. Typically, this is adequate for most Windows Forms applications. However, you may want to opt out of one or more individual features. The most important reason for doing this is that your existing application code already handles that feature. For example, if your application handles auto scaling, you might want to disable the auto-resizing feature as follows:


In addition to running on .NET Framework 4.7 and Windows 10 Creators Update, your application may also run in an environment in which it isn't compatible with high DPI improvements. In this case, you'll need to develop a fallback for your application. You can do this to perform custom drawing to handle scaling.


In order to ease this issue, starting with the April 2018 Update (version 1803), Windows 10 introduces a new option in the "Advanced scaling settings" page that detects and tries to fix blurry apps automatically the next time you open them. However, if the feature isn't working as expected, you can also choose the high DPI settings a particular app should use to override the global settings.


It's worth noting that in step No. 5, you can also use the High DPI scaling override options to change the default scaling behavior for a program that is blurry from the very beginning.


These settings are only available for classic desktop applications, as Microsoft Store apps are already designed to handle high pixel density displays. Also, these new improvements work for apps running on your primary monitor. If you have a multi-monitor setup using different scaling settings and using the extended mode, applications may still look blurry on the other monitors.


Microsoft today detailed the high-DPI scaling improvements that will be delivered as part of upcoming Windows 10 Creators Update. If you are running multiple monitor setup with different resolutions, these improvements will make your life a lot easier. Read about them below. 2ff7e9595c


1 view0 comments

Recent Posts

See All

Comments


bottom of page