如何在BHO中获取网页元素的屏幕坐标 [英] How to get the screen coordinate of web-page elements in BHO

查看:107
本文介绍了如何在BHO中获取网页元素的屏幕坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为IE编写BHO对象.

I am writing a BHO object for IE.

我想要网页左上角的屏幕位置.我该如何获得这个职位? DOM中第一个元素的左上角返回(0,0). webBrowser.Left或Top返回浏览器的位置,但不返回页面的左上角.我正在使用IWebBrowser2.

I want the screen position of the top-left of the web-page. How can i get this position? The topleft of the first element in DOM returns (0,0). The webBrowser.Left or Top returns the position of the browser but not the top-left of the page. I am using IWebBrowser2.

感谢一百万,

-匿名.

推荐答案

我自己解决了这个问题.

I solved the problem myself.

IHTMLElement2.getBoundingClientRects()和IHTMLElement2.getClientRects()解决了这个问题.

The IHTMLElement2.getBoundingClientRect() and IHTMLElement2.getClientRects() solved the problem.

-达特

这篇关于如何在BHO中获取网页元素的屏幕坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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