我正在努力在VB.NET应用程序中滚动Web浏览器控件,并且能够在代码中慢慢地通过计时器滚动到文档的末尾.我想知道的是,如果有一种方法可以告诉我什么时候滚动到底部,这样我就可以回滚
我试图检查文档的高度,但它只是我屏幕的高度.是否有一个属性,我可以检查以确定我是否在底部滚动目的?
我目前滚动到页面底部的方式是:
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted Timer2.Enabled = True End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick scrollPos = scrollPos + 50 WebBrowser1.Document.Window.ScrollTo(0, scrollPos) End Sub尝试这样可以解决您的问题
Private Function IsBottom() As Boolean 'return True if scroll reached body's bottom, else False Return (scrollPos >= WebBrowser1.Document.Body.ScrollRectangle.Height) End Function