Windows Forms C# application - Webbrowser control not displaying html content when DPI Scaling is 125%

Srinivas AK 21 Reputation points
2020-12-31T11:38:25.377+00:00

We had designed a Windows Form application such that it is suitable for all the resolutions. Now, we came across a situation where the custom html is not getting displayed in the WebBrowser control when we choose 125% or 150% for the font size . It is getting displayed correctly when i choose 100% as shown in screenshot below

52475-html-100.png

I had set the screen resolution to 1440x900 and changed the setting to 125% as shown in screenshot below. In this case a blank page is getting displayed in WebBrowser control. I am using the following code to display the html content in the WebBrowser control

WebBrowser1.DocumentText =  
            "<html><body>Please enter your name:<br/>" +  
            "<input type='text' name='userName'/><br/>" +  
            "<a href='http://www.microsoft.com'>continue</a>" +  
            "</body></html>"  

52504-ra35s.png

Can you please suggest on why the html content is not getting displayed when i choose 125% whereas it is getting displayed when i choose 100% and provide a solution for it?

Developer technologies | Windows Forms
{count} votes

Your answer

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