Hide Scrollbars in the webBrowser control

前端 未结 1 594
心在旅途
心在旅途 2021-02-19 06:20

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 look

1条回答
  •  逝去的感伤
    2021-02-19 06:55

    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";
    }
    

    0 讨论(0)
提交回复
热议问题