Share via

Rendering outside VSTO panel when using WebView2 control on mixed DPI screens

Tomasz P 1 Reputation point
2021-12-23T08:20:07.237+00:00

I'm trying to use WebView2 for rendering all content in VSTO panel. I'm struggling with the issue when my plugin is used in a system with multiple monitors which have different scaling / DPI settings. The content is rendered in random place outside TaskPane. To be precise - this is only rendering issue, as all hit tests seems to be working in proper places.

159888-outlook-dpi-issue.png

The exact issue was reported to edge / webview team by other people as well, but it seems the issue is on Office side. Here is the thread for the reference:
https://github.com/MicrosoftEdge/WebView2Feedback/issues/820

Hopefully perhaps is there any workaround? This is a major showstopper for me and our clients.

I'm using Win10 21H2, .Net framework 4.6.2, Outlook version 2102, webview 1.0.1054.31, edge 96.0.1054.62

Microsoft 365 and Office | Development | Other
0 comments No comments

2 answers

Sort by: Most helpful
  1. Marek Pecikiewicz 1 Reputation point
    2022-01-13T08:09:59.95+00:00

    Similar issue here, but WebView2 pops out completely outside of Outlook window. It happens when I drag Outlook window from the screen with higher DPI to the screen with lower DPI. Outlook window opened on the screen with higher DPI displays WebView2 properly.

    I've already tried to somehow handle control position from the code, but without any luck. Some info on Office solutions scaling here:
    https://learn.microsoft.com/en-us/office/client-developer/ddpi/handle-high-dpi-and-dpi-scaling-in-your-office-solution

    The only way to make Webview2 stay in place is to set "Display options" in Outlook to "Optimize for compatibility", but it generally causes Outlook to look blurred. (https://davton.com/blog/outlook-update-breaks-plugins/)

    The same issue happens on Outlook 2112 (Office 365) and was happening on Outlook 2019.

    Was this answer helpful?

    0 comments No comments

  2. Z_DK 1 Reputation point
    2022-01-06T07:59:22.767+00:00

    I have the same problem.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.