Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How do i get the screen coordinates of an IHTMLElement?

How do i get the screen coordinates of an IHTMLElement?

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kartikdasani
    wrote on last edited by
    #1

    I have tried to use a combination of get_offsetheight,get_offsetwidth,get_offsettop and getoffsetleft but the values returned are in reference to the immediate parent.

    C S 2 Replies Last reply
    0
    • K kartikdasani

      I have tried to use a combination of get_offsetheight,get_offsetwidth,get_offsettop and getoffsetleft but the values returned are in reference to the immediate parent.

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      What do you mean by screen coordinates? Did you try "walking up" the inheritance tree, adding the offsets till you reach the top?

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<

      1 Reply Last reply
      0
      • K kartikdasani

        I have tried to use a combination of get_offsetheight,get_offsetwidth,get_offsettop and getoffsetleft but the values returned are in reference to the immediate parent.

        S Offline
        S Offline
        Skynet_Code
        wrote on last edited by
        #3

        Hello. That's exactly what the method you're invoking returns, the height/width referenced to its parent coordinate system. If you want to get the offset referenced to the screen (1st level of DOM) you can get it by adding all offset values invoking recursively to 'get_offsetParent' method (n-1) times. Hope it helps. Regards

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups