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

前端 未结 7 1808
刺人心
刺人心 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:08

    I found kurt's answer almost worked but had to change the array reference as follows:

    var document = (HTMLDocument)Browser.Document;
    var scrollTop = (int)document.getElementsByTagName("HTML").item(0).ScrollTop;
    

提交回复
热议问题