Handle high-DPI scaling in your Office solutions

Office Add-ins team

Higher display resolutions with increased DPI (dots per inch) scale have introduced new requirements for applications to support high DPI. A common scenario is when an application is moved from one display to a new display with a different DPI (such as a multi-monitor configuration). The application needs to adjust and render its UI correctly on the new DPI scale.

For your Office solutions, those will also need to handle DPI scaling when your solution is moved to a display with a different DPI. To help you handle DPI changes in your Office solutions, we published a new article, Handle high DPI and DPI scaling in your Office solution. This article explains how to handle DPI changes for the following types of solutions:

  • VSTO Add-ins
  • Custom task panes
  • COM Add-ins
  • ActiveX controls
  • Ribbon extensions
  • OLE servers
  • Office web add-ins

Windows DPI awareness modes

Fundamental to how you work with DPI changes are the Windows DPI awareness modes. Which mode the application runs under determines how it is notified of DPI changes. For example, an Office application such as Excel typically runs as Per Monitor aware DPI mode. In Per Monitor aware DPI mode, Windows sends DPI change notifications to the top-level windows of that application. But child windows will not receive notifications. If your solution is a child window created by an Office application window, then you still need a method to obtain DPI changes. In the article, you can find more details about handling DPI changes in child windows in the Child window management section.

There may be some scenarios where existing solutions may not display as expected. In these cases, a user can configure Office to optimize for compatibility. This forces Office applications to run in System DPI awareness mode. Windows will not send DPI change notifications and instead bitmap stretches the application window and child windows when moved to displays with a different DPI. The article has more information in the Office and Windows DPI compatibility settings section. 

Managing thread DPI context

DPI awareness modes are set at the thread level. Sometimes you need to switch the thread DPI context. For example, if Office calls your solution code on a thread set to Per Monitor DPI aware, but your window was created for Per Monitor v2 awareness, you need to switch the thread DPI context on the incoming call. You can find more details and code samples in the Managing thread DPI context section. 

Diagram showing DPI awareness modes

Find guidance for your solution 

If you just want to get to the recommended guidance for your solution type, see the table in the How to support DPI scaling in your solution section. The table lists each solution type and has a quick link to guidance on how to support DPI scaling.  

As we develop new code samples and DPI-scaling approaches, we’ll continue updating this article. Please let us know what you think by choosing the Content Feedback link at the bottom of the article.  

Thanks, Office Extensibility Team 

Feedback usabilla icon