Removing border from WebBrowser control

前端 未结 4 1062
半阙折子戏
半阙折子戏 2021-01-18 17:25

I\'ve got a WebBrowser control sitting on a Form which has an irritating 2px inset-looking border around it. It\'s causing my content to be clipped by 4 px on the right and

4条回答
  •  独厮守ぢ
    2021-01-18 17:38

    I have resolved the same problem by adding border:none; style attribute into the html element.

    
    

    First I tried to add it into the body element but It didn't work, but it works on root html element.

    The IE version used on Windows XP for WebBrowser object - I think the version 6 - interprets the root html element as having a border by default. If you have direct control over the web page displayed in the WebBrowser, you can add a style attribute directly to the HTML source of the page - as I did -, If not, There should be a way to edit the HTML inside the WebBrowser programmatically on the side of your application.

提交回复
热议问题