We're currently building an add-in to host an some html content as a VSTO add-in for Outlook. However, on a hidpi display the scaling factor for the WebBrowser control is incorrect. Instead of scaling based on the scaled displayed percentage (250% on a 4k 15in display) it's leaving the scaling at 100%. I've verified this by querying window.devicePixelRatio
which is just returning 1.0.
I've tried using an answer described here: https://social.msdn.microsoft.com/Forums/en-US/151dcd48-4f09-4701-aa10-edc34617e7f2/how-to-zoom-a-web-browser-programatically-in-c?forum=csharpgeneral which applies zoom on the WebBrowser control itself however only text elements appear to zoom.
I've also tried applying a zoom style on the HTML document itself from the WebBrowser control webBrowser.Document.Body.Style = "zoom: 150%;"
When hosting the same code in a standalone WinForms application, window.devicePixelRatio
is the expected value of 2.50
and everything just works.
Are there any known workarounds other than those described above?