Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide Scrollbars in the webBrowser control

Tags:

c#

winforms

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?

like image 399
Siegeon Avatar asked Jul 26 '12 22:07

Siegeon


1 Answers

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";
}
like image 113
LarsTech Avatar answered Sep 20 '22 20:09

LarsTech