{"id":2633,"date":"2019-03-09T00:57:49","date_gmt":"2019-03-09T08:57:49","guid":{"rendered":"https:\/\/developer.microsoft.com\/en-us\/office\/blogs\/?p=2633"},"modified":"2019-03-09T00:57:49","modified_gmt":"2019-03-09T08:57:49","slug":"handle-high-dpi-scaling-in-your-office-solutions","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/handle-high-dpi-scaling-in-your-office-solutions\/","title":{"rendered":"Handle high-DPI scaling in your Office solutions"},"content":{"rendered":"<p>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.<\/p>\n<p><span class=\"TextRun SCXW165062535 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW165062535 BCX0\">For your Office solutions, those will also need to handle\u00a0<\/span><\/span><span class=\"TextRun SCXW165062535 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW165062535 BCX0\">DPI scaling when your solution is moved to a display with a different DPI.\u00a0<\/span><\/span><span class=\"TextRun SCXW165062535 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW165062535 BCX0\">To help you handle DPI changes in your Office solutions, we published a new article,\u00a0<\/span><\/span><a href=\"https:\/\/docs.microsoft.com\/en-us\/office\/client-developer\/ddpi\/handle-high-dpi-and-dpi-scaling-in-your-office-solution\"><span class=\"TextRun Underlined SCXW165062535 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW165062535 BCX0\">Handle high DPI and DPI scaling in you<\/span><\/span><span class=\"TextRun Underlined SCXW165062535 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW165062535 BCX0\">r Office solution<\/span><\/span><\/a><span class=\"TextRun SCXW165062535 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW165062535 BCX0\">.<\/span><\/span><span class=\"TextRun SCXW165062535 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW165062535 BCX0\">\u00a0This article explains how to handle DPI changes\u00a0<\/span><\/span><span class=\"TextRun SCXW165062535 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"ContextualSpellingAndGrammarError SCXW165062535 BCX0\">for<\/span><\/span><span class=\"TextRun SCXW165062535 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW165062535 BCX0\">\u00a0the following types of solutions:<\/span><\/span><\/p>\n<ul>\n<li>VSTO Add-ins<\/li>\n<li>Custom task panes<\/li>\n<li>COM Add-ins<\/li>\n<li>ActiveX controls<\/li>\n<li>Ribbon extensions<\/li>\n<li>OLE servers<\/li>\n<li>Office web add-ins<\/li>\n<\/ul>\n<h2><span class=\"TextRun SCXW65895805 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW65895805 BCX0\">Windows DPI awareness modes<\/span><\/span><\/h2>\n<p><span class=\"TextRun SCXW132976278 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW132976278 BCX0\">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.\u00a0<\/span><\/span><span class=\"TextRun SCXW132976278 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun CommentStart SCXW132976278 BCX0\">If your solution is a child\u00a0<\/span><\/span><span class=\"TextRun SCXW132976278 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW132976278 BCX0\">window created by an Office application window<\/span><\/span><span class=\"TextRun SCXW132976278 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW132976278 BCX0\">, then you still need a method to obtain DPI changes.\u00a0<\/span><\/span><span class=\"TextRun SCXW132976278 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW132976278 BCX0\">In the article, you can find more details about handling DPI changes in child windows in the<a href=\"https:\/\/docs.microsoft.com\/en-us\/office\/client-developer\/ddpi\/handle-high-dpi-and-dpi-scaling-in-your-office-solution#child-window-management\">\u00a0<\/a><\/span><\/span><span class=\"TextRun Underlined SCXW132976278 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW132976278 BCX0\">Child window management sectio<\/span><\/span><span class=\"TextRun Underlined SCXW132976278 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW132976278 BCX0\">n<\/span><\/span><span class=\"TextRun SCXW132976278 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW132976278 BCX0\">.<\/span><\/span><\/p>\n<p><span class=\"TextRun SCXW43636372 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW43636372 BCX0\">There may be some scenarios where existing solutions may not\u00a0<\/span><\/span><span class=\"TextRun SCXW43636372 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW43636372 BCX0\">display<\/span><\/span><span class=\"TextRun SCXW43636372 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW43636372 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW43636372 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW43636372 BCX0\">as expected. In these cases<\/span><\/span><span class=\"TextRun SCXW43636372 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW43636372 BCX0\">, 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\u00a0<\/span><\/span><span class=\"TextRun SCXW43636372 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW43636372 BCX0\">and child windows\u00a0<\/span><\/span><span class=\"TextRun SCXW43636372 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW43636372 BCX0\">when moved to displays with a different DPI. The article has more information in the\u00a0<\/span><\/span><a class=\"Hyperlink SCXW43636372 BCX0\" href=\"https:\/\/docs.microsoft.com\/en-us\/office\/client-developer\/ddpi\/handle-high-dpi-and-dpi-scaling-in-your-office-solution#office-and-windows-dpi-compatibility-settings\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"TextRun Underlined SCXW43636372 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW43636372 BCX0\">Office and Windows DPI compatibility settings section<\/span><\/span><\/a><span class=\"TextRun SCXW43636372 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW43636372 BCX0\">.<\/span><\/span><span class=\"EOP SCXW43636372 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<h2><span class=\"TextRun SCXW45390357 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW45390357 BCX0\">Managing\u00a0<\/span><span class=\"ContextualSpellingAndGrammarError SCXW45390357 BCX0\">thread<\/span><span class=\"NormalTextRun SCXW45390357 BCX0\">\u00a0<\/span><\/span><span class=\"TextRun SCXW45390357 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW45390357 BCX0\">DPI\u00a0<\/span><\/span><span class=\"TextRun SCXW45390357 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW45390357 BCX0\">context<\/span><\/span><\/h2>\n<p><span class=\"TextRun SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW24757075 BCX0\">DPI awareness modes are set at the thread level.\u00a0<\/span><\/span><span class=\"TextRun SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW24757075 BCX0\">Sometimes you need to switch the thread DPI context<\/span><\/span><span class=\"TextRun SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW24757075 BCX0\">. For example, if Office calls your solution code on a thread set to Per Monitor DPI aware, but your window w<\/span><\/span><span class=\"TextRun SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW24757075 BCX0\">as<\/span><\/span><span class=\"TextRun SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW24757075 BCX0\">\u00a0created for Per Monitor\u00a0<\/span><\/span><span class=\"TextRun SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW24757075 BCX0\">v<\/span><\/span><span class=\"TextRun SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW24757075 BCX0\">2<\/span><\/span><span class=\"TextRun SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW24757075 BCX0\">\u00a0awareness<\/span><\/span><span class=\"TextRun SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW24757075 BCX0\">, you need to switch the thread<\/span><\/span><span class=\"TextRun SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW24757075 BCX0\">\u00a0DPI<\/span><\/span><span class=\"TextRun SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW24757075 BCX0\">\u00a0context on the incoming call.\u00a0<\/span><\/span><span class=\"TextRun SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW24757075 BCX0\">You can find more details and code samples in the\u00a0<\/span><\/span><a class=\"Hyperlink SCXW24757075 BCX0\" href=\"https:\/\/docs.microsoft.com\/en-us\/office\/client-developer\/ddpi\/handle-high-dpi-and-dpi-scaling-in-your-office-solution#managing-thread-dpi-context\" target=\"_blank\" rel=\"noopener noreferrer\"><span class=\"TextRun Underlined SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW24757075 BCX0\">Managing thread DPI context section<\/span><\/span><\/a><span class=\"TextRun SCXW24757075 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW24757075 BCX0\">.<\/span><\/span><span class=\"EOP SCXW24757075 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-2634\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2019\/03\/thread-dpi-awareness-context-block.png\" alt=\"Diagram showing DPI awareness modes\" width=\"525\" height=\"872\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2019\/03\/thread-dpi-awareness-context-block.png 525w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2019\/03\/thread-dpi-awareness-context-block-181x300.png 181w\" sizes=\"(max-width: 525px) 100vw, 525px\" \/><\/p>\n<h2><span class=\"TextRun SCXW45272342 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW45272342 BCX0\">Find guidance for your solution<\/span><\/span><span class=\"EOP SCXW45272342 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/h2>\n<p><span data-contrast=\"auto\">If you just want to get to the recommended guidance for your solution type, see the table in the\u00a0<\/span><a href=\"https:\/\/docs.microsoft.com\/en-us\/office\/client-developer\/ddpi\/handle-high-dpi-and-dpi-scaling-in-your-office-solution#how-to-support-dpi-scaling-in-your-solution\"><span data-contrast=\"none\">How to support DPI scaling in your solution<\/span><\/a><span data-contrast=\"auto\">\u00a0section. The table lists each solution type and has a quick link to guidance\u00a0on how to support DPI scaling.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">As\u00a0<\/span><span data-contrast=\"auto\">we develop\u00a0<\/span><span data-contrast=\"auto\">new code samples and DPI-scaling approaches, we\u2019ll continue updating this article. Please let us know what you think\u00a0<\/span><span data-contrast=\"auto\">by choosing the <strong>Content Feedback<\/strong> link at the bottom of the article.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Thanks,<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\n<\/span><span data-contrast=\"auto\">Office Extensibility Team<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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, COM add-ins, ActiveX controls, ribbon extensions, OLE servers, Office add-ins, and custom task panes.<\/p>\n","protected":false},"author":69076,"featured_media":25159,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11],"tags":[36,133],"class_list":["post-2633","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office-add-ins","tag-office-ui-fabric","tag-windows-dpi"],"acf":[],"blog_post_summary":"<p>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, COM add-ins, ActiveX controls, ribbon extensions, OLE servers, Office add-ins, and custom task panes.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/2633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/users\/69076"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=2633"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/2633\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/25159"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=2633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=2633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=2633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}