从WebBrowser控件C#获取滚动值 [英] getting the scroll value from a WebBrowser Control C#

查看:191
本文介绍了从WebBrowser控件C#获取滚动值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得在WebBrowser控件的网页在Y滚动索引,但我不能为内置的滚动条访问值。

I am trying to get the Y scroll index for a web page in the WebBrowser control but I can't access the values for the built in Scroll bar.

任何想法?

推荐答案

有关IE在标准模式(文档类型,像你说的) scrollTop的是一个属性< HTML> 元素,而不是<身体GT;

For IE in standards mode (with a doctype, as you say) scrollTop is a property of the <html> element, not the <body>:

HtmlDocument htmlDoc = this.webBrowser1.Document;
int scrollTop = htmlDoc.GetElementsByTagName("HTML")[0].ScrollTop;



(一个更好的方式来获得的< HTML> 元素将是一件好事,如果有人一知道。)

(A nicer way to get to the <html> element would be good, if anyone knows of one.)

这篇关于从WebBrowser控件C#获取滚动值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆