如何在BHO中获取网页元素的屏幕坐标
我正在为 IE 编写一个 BHO 对象。
我想要网页左上角的屏幕位置。我怎样才能得到这个职位? DOM 中第一个元素的左上角返回 (0,0)。 webBrowser.Left 或 Top 返回浏览器的位置,但不返回页面的左上角。我正在使用 IWebBrowser2。
谢谢一百万,
-匿名。
I am writing a BHO object for IE.
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.
Thanks a million,
-anony.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能已经弄清楚了这一点,但使用 ClientToScreen 函数可能会有所帮助你。
You may have already figured this out, but using ClientToScreen function might help you.
我自己解决了这个问题。
IHTMLElement2.getBoundingClientRect() 和 IHTMLElement2.getClientRects() 解决了这个问题。
-达特
I solved the problem myself.
The IHTMLElement2.getBoundingClientRect() and IHTMLElement2.getClientRects() solved the problem.
-Datte