Skip to content

Webview2 Not Scaling on High DPI monitor when gdiScaling is true #1700

@veevandyke

Description

@veevandyke

Description
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?

Version
SDK: 1.0.902.49
Runtime: 92.0.902.84
Framework: WinForms
OS: Win10

Repro Steps
Create a windows form. Place a webview2 control on the form. Dock or Anchor form. Open form on a scaled monitor. Note that I can repro the images below by simply dragging the form from one window to the other. It doesn't matter which monitor is primary/secondary or even IF there is a secondary monitor. Issue persists when there is only one monitor and it is scaled.

Screenshots
Scaled monitor:
Scaled

Unscaled Monitor
Unscaled Monitor

AB#35684950

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtrackedWe are tracking this work internally.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions