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

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

    For anyone interested, here's the C# code equivalent to Marc's answer:

    System.Windows.Forms.HtmlDocument htmlDoc = webBrowser.Document;
    if (htmlDoc != null)
    {
        int scrollTop = htmlDoc.GetElementsByTagName("HTML")[0].ScrollTop;
        int scrollLeft = htmlDoc.GetElementsByTagName("HTML")[0].ScrollLeft;
    }
    
    0 讨论(0)
提交回复
热议问题