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. Help!! "Device Context"

Help!! "Device Context"

Scheduled Pinned Locked Moved C / C++ / MFC
help
7 Posts 5 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.
  • H Offline
    H Offline
    himuskanhere
    wrote on last edited by
    #1

    Can any explain me diff ways of obtaining DCs. In my problem, I have to draw some geometric figure from a function(methode) where i dont have DC. Thanks in advance!! :cool:

    S M 2 Replies Last reply
    0
    • H himuskanhere

      Can any explain me diff ways of obtaining DCs. In my problem, I have to draw some geometric figure from a function(methode) where i dont have DC. Thanks in advance!! :cool:

      S Offline
      S Offline
      sakssp
      wrote on last edited by
      #2

      Use GetDC() of CDC

      H 1 Reply Last reply
      0
      • S sakssp

        Use GetDC() of CDC

        H Offline
        H Offline
        himuskanhere
        wrote on last edited by
        #3

        no, i m not getting DC using GetDC...

        S CPalliniC R 3 Replies Last reply
        0
        • H himuskanhere

          no, i m not getting DC using GetDC...

          S Offline
          S Offline
          sakssp
          wrote on last edited by
          #4

          Do you want to draw on it on MainWnd or On any other window or dialog?

          1 Reply Last reply
          0
          • H himuskanhere

            no, i m not getting DC using GetDC...

            CPalliniC Offline
            CPalliniC Offline
            CPallini
            wrote on last edited by
            #5

            With Win32 function ::GetDC(NULL) you can get the handle of the screen DC.

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

            In testa che avete, signor di Ceprano?

            1 Reply Last reply
            0
            • H himuskanhere

              no, i m not getting DC using GetDC...

              R Offline
              R Offline
              Rajkumar R
              wrote on last edited by
              #6

              Hi, Always draw on OnDraw(), and / or OnPaint() (MFC). From Outside these function call RedrawWindow() to update.

              1 Reply Last reply
              0
              • H himuskanhere

                Can any explain me diff ways of obtaining DCs. In my problem, I have to draw some geometric figure from a function(methode) where i dont have DC. Thanks in advance!! :cool:

                M Offline
                M Offline
                Mark Salsbery
                wrote on last edited by
                #7

                It depends on what you need a DC for (what you want to draw on). A DC is a "device context". It represents the drawing attributes of a device. If you need a DC to draw in the client area of a window you can use GetDC(); If you want to be able to draw on an entire window (not just the client are) there's GetWindowDC(). To draw anywhere on the screen, either of the above can be used to obtain a screen DC. For non-screen-related devices there's CreateDC() For drawing to memory there's CreateCompatibleDC(); Mark

                "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

                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