C#Webbrowser问题,我需要将页面滚动到特定位置,我可以吗? [英] C# Webbrowser Probplem, I Need To Scroll Page To Specific Location, I Can?
本文介绍了C#Webbrowser问题,我需要将页面滚动到特定位置,我可以吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试在一个非常小的框架中打开一个大的网页
我有很多要滚动的内容我想自动滚动到一个特定的点
如何你能做这样的事吗?请帮助
解决方案
尝试下面的代码
Point scrollPoint = new Point(50,50);
if(webBrowser1.Document!= null){
webBrowser1.Document.Window.ScrollTo(scrollPoint);
}
如果您需要向下滚动到文档底部
webBrowser1.Document.Body .ScrollIntoView(false);
到文档顶部
webBrowser1.Document.Body.ScrollIntoView(true) ;
http://msdn.microsoft.com/en-us/library/system.windows.forms。 htmlelement.scrollintoview.aspx?cs-save-lang = 1& cs-lang = csharp#code-snippet-2 [ ^ ]
I try to open a large web page in a very small frame
I have a lot to scroll through and I want to automatically scroll to a specific point
How can you do such a thing? Please help
解决方案
try below code
Point scrollPoint =new Point(50, 50); if (webBrowser1.Document != null){ webBrowser1.Document.Window.ScrollTo(scrollPoint); }
if you need to scroll down to bottom of the document
webBrowser1.Document.Body.ScrollIntoView(false);
to top of the document
webBrowser1.Document.Body.ScrollIntoView(true);
http://msdn.microsoft.com/en-us/library/system.windows.forms.htmlelement.scrollintoview.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2[^]
这篇关于C#Webbrowser问题,我需要将页面滚动到特定位置,我可以吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文