I'm using a web browser control to display some on-the-fly generated HTML documents in my application.
Problem is, on my machine said documents are displayed kinda zoomed in. On other colleagues' computers, everything looks "normal". It has to be some kind of local setting but I can't find where to change it.
I can CTRL + Scroll wheel to zoom out, but zoom level is not retained. As far as I can see, there's no easy way to set the predefined zoom level programmatically.
It may be a long shot but I fear it has something to do with Internet Explorer (which I never use) and its settings. Changing control type is not a viable option, unfortunately.
Any help would really be appreciated, thank you.
Its windows 10 issue all HDPI devices goes to 200% zoom level automatically. To get started, right-click any empty space on your desktop and select Display settings towards the bottom of the context menu. Alternatively, you can go to Start > Settings > System > Display. The Settings app in Windows 10 is ready for per-monitor display scaling.
There is no proper fix for it as I have three screens and all has different display hdpi and I get 200% zoom automatically . So 1 screen shows it ok and other 2 are extra zoomed.
Might it be that your display is scaled? (Assuming Win 10, but older versions must be pretty similar)
desktop, context menu -> display settings -> under Scale and Layout, is yours set to a value higher than 100%?
The problem is with Screen Resolution. Your screen is on less resolution setting whereas your colleagues' screen is set with higher resolution than yours.
Change your screen resolution to same as your colleagues' screen resolution or vice-versa and you should see the issue resolved.
Internet Explorer respects to the windows scale settings. As a result the size that you will see on
WebBrowser
control on a system having scaling 100, is different from the size which you see onWebBrowser
control on a system having scaling 150, while bothWebBrowser
controls set to 100% zoom.The reason is because of scaling. The scaling factor is same as Windows scaling factor divided by 100 or
physicalScreenHeight/logicalScreenHeight
.In fact there is. To change the zoom level of Web Browser control, you can get
IWebBrowser2
instance from theWebBrowser.ActiveXInstance
property and then using itsExecWB
method, set set the zoom this way:You can also add reference to
Microsoft Internet Controls (SHDocVw.dll)
and castWebBrowser.ActiveXInstance
toSHDocVw.WebBrowser
and useExecWB
method. But above code does the trick without adding any reference.Web browser zoom is completely different from CSS3 zoom. But you may want to know about how to set document body zoom:
webBrowser1.Document.Body.Style = "zoom:200%";
All above codes should be run after document has been completed.