在 webBrowser 控件中隐藏滚动条 [英] Hide Scrollbars in the webBrowser control
问题描述
我正在开发用于 Windows 窗体的 HTML 显示控件.我使用 webBrowser 控件作为我的控件的基础,我需要隐藏 webBrowser 滚动条,因为它看起来很糟糕,永远不会被使用,并使控件看起来像一个破坏布局的网页.目前,滚动条呈现在控件上,看起来都很沮丧和灰色.有没有办法简单地将其全部删除?
有一个属性:
webBrowser1.ScrollBarsEnabled = false;
<块引用>
指定 WebBrowser 控件是否应具有滚动条.
但是,如果查看的网页大于当前控件的大小(并非在所有情况下),它们可以"出现.
这个答案允许用鼠标滚动但不显示浏览器滚动条?显示了这个方法:
void webBrowser1_DocumentCompleted(object sender,WebBrowserDocumentCompletedEventArgs e) {webBrowser1.Document.Body.Style = "溢出:隐藏";}
I am working on an HTML display control for windows forms. I am using the webBrowser control as the base for my control and I need to hide the webBrowsers scroll bar, as it looks bad, will never be used, and makes the control look like a webPage which ruins the layout. Currently the scroll bar renders on the control looking all dejected and greyed out. Is there way to simply remove it all together?
There is a property:
webBrowser1.ScrollBarsEnabled = false;
Specifies whether the WebBrowser control should have scrollbars or not.
They "can" appear however if the viewed web page is larger than the current control's size (not in all cases).
This answer Allow scroll with mouse but don't show browser scrollbars? shows this method:
void webBrowser1_DocumentCompleted(object sender,
WebBrowserDocumentCompletedEventArgs e) {
webBrowser1.Document.Body.Style = "overflow:hidden";
}
这篇关于在 webBrowser 控件中隐藏滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!