How to get the screen coordinate of web-page elements in BHO

吃可爱长大的小学妹 提交于 2019-12-10 12:07:57

问题


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.


回答1:


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




回答2:


I solved the problem myself.

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

-Datte



来源:https://stackoverflow.com/questions/1330278/how-to-get-the-screen-coordinate-of-web-page-elements-in-bho

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!