WebView2 doesn't scale on scaled monitor

Viewed 590

I have a form on which I was using the old webbrowser control. Support is going away, so I am upgrading to the new webview2 control. My entire app is scaling properly (on high DPI monitors) using these settings in the app.manifest:

  <asmv3:application>
    <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> 
      <!-- legacy -->
      <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness>
      <gdiScaling>true</gdiScaling>
    </asmv3:windowsSettings>
  </asmv3:application>

Here's the problem: My webview2 control is NOT scaling. (Monitor scaled at 200%.) So when I open the form on my high DPI monitor, the webview control takes up about 25 of the total form, even though it's docked to take up the entire form. If I move the form to my non-scaled monitor, it displays properly. I tested the size of the webview control and even though it's taking up 25% of the form, the actual pixel size is the same as the form. (Form is 1200x800, Webview control is 1180x760.)

What do I need to do to make this display properly on a scaled monitor?

Screenshots: Scaled Monitor - Scaled Monitor

Un-scaled monitor - Unscaled monitor

0 Answers
Related