How to retrieve the scrollbar position of the webbrowser control in .NET

前端 未结 7 1827
刺人心
刺人心 2020-12-11 18:44

I tried using webBrowser1.Document.Body.ScrollTop and webBrowser1.Document.Body.ScrollLeft, but they don\'t work. They always return 0 and I can\'t

7条回答
  •  难免孤独
    2020-12-11 19:06

    You can check documentElement

    IHTMLElement2 page = 
    (wb.Document.DomDocument as IHTMLDocument3).documentElement as IHTMLElement2;
    int pos = page.scrollTop;
    

提交回复
热议问题