如何在BHO中获取网页元素的屏幕坐标

发布于 2024-08-02 16:20:00 字数 177 浏览 17 评论 0原文

我正在为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

如果没结果 2024-08-09 16:20:00

您可能已经弄清楚了这一点,但使用 ClientToScreen 函数可能会有所帮助你。

You may have already figured this out, but using ClientToScreen function might help you.

小…楫夜泊 2024-08-09 16:20:00

我自己解决了这个问题。

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

-达特

I solved the problem myself.

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

-Datte

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文