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. DC absolute position

DC absolute position

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.
  • G Offline
    G Offline
    Goa
    wrote on last edited by
    #1

    how can i get absolute position of my DC on the screen?

    S A 2 Replies Last reply
    0
    • G Goa

      how can i get absolute position of my DC on the screen?

      S Offline
      S Offline
      Scott H Settlemier
      wrote on last edited by
      #2

      Device contexts don't really have a position on the screen. They are used to represent a drawable surface-- be it for a printer, a window, or what-have-you. A window on the screen is painted from the contents (of a bitmap) to which the dc is representative. This painting occurs where the window is located irregardless of anything about the dc. i.e. the position is a property of the window and not its dc. To get the position of a window on screen, just use GetWindowRect.

      1 Reply Last reply
      0
      • G Goa

        how can i get absolute position of my DC on the screen?

        A Offline
        A Offline
        alex barylski
        wrote on last edited by
        #3

        Depends on what DC you want I guess. 1) CClientDC 2) CWindowDC Then i'm guessing you could call GetClientRect() and GetWindowRect() and convert the logical points to device points using LPtoDP() which would give you the absolute position of the requested DC in pixels (i think). Cheers! :) "An expert is someone who has made all the mistakes in his or her field" - Niels Bohr

        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