本文介绍了如何在Web浏览器控件中垂直向下滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在c#的 WebBrowser 组件中向下滚动滚动条? 我尝试了以下代码,但没有完成作业:
How can I scroll down the scroll bar in WebBrowser component in c#? I tried the following code , but it doesn't did the job:
webBrowser2.Focus(); webBrowser2.Document.Body.ScrollIntoView(false);推荐答案
要滚动到特定位置,可以使用 WebBrowser.Document.Window.ScrollTo (x,y) 方法。例如,向下滚动到正文末尾:
To scroll to a specific location, you can use WebBrowser.Document.Window.ScrollTo(x,y) method. For example to scroll down to the end of body:
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { webBrowser1.Document.Window.ScrollTo(0, webBrowser1.Document.Window.Size.Height); }要滚动到特定元素,可以使用 ScrollIntoView 方法。
To scroll to a specific element, you can use ScrollIntoView method.
更多推荐
如何在Web浏览器控件中垂直向下滚动
发布评论