WebView2 at 4K monitor is displayed incorrectly

Maroš Dziak 0 Reputation points

I have problem with my windows application, that i started to develop. After many issues with displaying correct visual at different dpi settings i came to state, that everywhere it is functional, except my friend's computer with 4K monitor.I have enabled PerMonitorV2 in app.manifest, tried all AutoScale setting for form, added true to gdiScaling app.manifest...Don't know how to solve this, any help?I have tried almost everything, that i've googled. I'm expecting help to solve displaying issues on 4K monitor with WebView2 component.

bug at 4K monitor


<application xmlns="urn:schemas-microsoft-com:asm.v3">
		<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
		<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness> <!-- DpiUnawareGdiScaled -->
		<gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling>
webView = new WebView2();  
webView.Visible = false;  
webView.Margin = new Padding(0);  
webView.Padding = new Padding(0);  
webView.Size = new Size(Width, 0);  
webView.AllowExternalDrop = false;  
webView.BackColor = BackgroundColor;  
webView.DefaultBackgroundColor = BackgroundColor;  
await webView.EnsureCoreWebView2Async();  
fContainer = new FlowLayoutPanel();  
fContainer.FlowDirection = FlowDirection.LeftToRight;  
fContainer.Size = new Size(Width, Height - (fTitle.Bottom - fTitle.Top) - (fActions.Bottom - fActions.Top));  
fContainer.BackColor = ApplicationFramework.FORM_BACK_COLOR;  
fContainer.Padding = new Padding(0);  
fContainer.Margin = new Padding(0);  
fContainer.WrapContents = false;  
fContainer.AutoSize = false;  
fContainer.AutoScroll = false;  
fContent = new FlowLayoutPanel();  
fContent.BackColor = ApplicationFramework.FORM_BACK_COLOR;  
fContent.FlowDirection = FlowDirection.TopDown;  
fContent.Size = new Size(Width - (HasMenu ?ApplicationFramework.MENU_WIDTH : 0), Height - (fTitle.Bottom - fTitle.Top) - (fActions.Bottom - fActions.Top));  
fContent.WrapContents = false;  
fContent.Padding = new Padding(0, ApplicationFramework.PADDING, 0, 0);  
fContent.Margin = new Padding(0);  
fContent.AutoScroll = true;  
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,611 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Maroš Dziak 0 Reputation points

    Ok, i found this problem at GitHub, can't do anything about it from my side ;)

    https://github.com/MicrosoftEdge/WebView2Feedback/issues?q=is%3Aissue+is%3Aopen+label%3Abug+wrong+position ;)

    0 comments No comments