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 to clear DC content?

How to clear DC content?

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutoriallearning
8 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.
  • H Offline
    H Offline
    houari_id
    wrote on last edited by
    #1

    Hi All.. I paint several lines in dialog using pDC->LineTo(a,b) (where: CDC *pDC = this->GetDC() ) After finish using it, I want to remove it from the screen and draw another things. How can I clear the dialog's DC? (of course, not by hide and show the dialog :) ) Thank you in advance... ps. i'm too lazy too search the boards... so, it would be ok if you have the link to the same question in this board... ^^

    -Houari

    M 1 Reply Last reply
    0
    • H houari_id

      Hi All.. I paint several lines in dialog using pDC->LineTo(a,b) (where: CDC *pDC = this->GetDC() ) After finish using it, I want to remove it from the screen and draw another things. How can I clear the dialog's DC? (of course, not by hide and show the dialog :) ) Thank you in advance... ps. i'm too lazy too search the boards... so, it would be ok if you have the link to the same question in this board... ^^

      -Houari

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

      To clear a window... Invalidate(TRUE); UpdateWindow(); ...will do it. Or using the DC, erase the background yourself using PatBlt() or whatever. Mark -- modified at 0:36 Thursday 22nd February, 2007

      "Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot? Of course you don't, no one does. It never happens. It's a dumb question... skip it."

      P H 2 Replies Last reply
      0
      • M Mark Salsbery

        To clear a window... Invalidate(TRUE); UpdateWindow(); ...will do it. Or using the DC, erase the background yourself using PatBlt() or whatever. Mark -- modified at 0:36 Thursday 22nd February, 2007

        "Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot? Of course you don't, no one does. It never happens. It's a dumb question... skip it."

        P Offline
        P Offline
        prasad_som
        wrote on last edited by
        #3

        Mark Salsbery wrote:

        To clear a window... Invalidate(TRUE); UpdateWindow(); ...will do it.

        It doesn't clear the window, is it ?

        Prasad Notifier using ATL | Operator new[],delete[][^]

        M 1 Reply Last reply
        0
        • M Mark Salsbery

          To clear a window... Invalidate(TRUE); UpdateWindow(); ...will do it. Or using the DC, erase the background yourself using PatBlt() or whatever. Mark -- modified at 0:36 Thursday 22nd February, 2007

          "Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot? Of course you don't, no one does. It never happens. It's a dumb question... skip it."

          H Offline
          H Offline
          houari_id
          wrote on last edited by
          #4

          It works using Invalidate and updatewindow... thanks! However, it seems that it does not work for the transparent dialog (using WS_EX_TRANSPARENT). The dialog becomes opaque if I use those function... Any idea? Thanks!

          -Houari

          M 1 Reply Last reply
          0
          • P prasad_som

            Mark Salsbery wrote:

            To clear a window... Invalidate(TRUE); UpdateWindow(); ...will do it.

            It doesn't clear the window, is it ?

            Prasad Notifier using ATL | Operator new[],delete[][^]

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

            A window that erases its background normally, yes. Transparent window no :) Also I was assuming the OP's drawing wasn't done in WM_PAINT handler. Bad assumption, bad answer :)

            "Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot? Of course you don't, no one does. It never happens. It's a dumb question... skip it."

            1 Reply Last reply
            0
            • H houari_id

              It works using Invalidate and updatewindow... thanks! However, it seems that it does not work for the transparent dialog (using WS_EX_TRANSPARENT). The dialog becomes opaque if I use those function... Any idea? Thanks!

              -Houari

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

              Then you'd need to redraw (or force to be redrawn) whatever is under the window. Or whatever is under the drawing you want to erase. Mark

              "Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot? Of course you don't, no one does. It never happens. It's a dumb question... skip it."

              H 1 Reply Last reply
              0
              • M Mark Salsbery

                Then you'd need to redraw (or force to be redrawn) whatever is under the window. Or whatever is under the drawing you want to erase. Mark

                "Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot? Of course you don't, no one does. It never happens. It's a dumb question... skip it."

                H Offline
                H Offline
                houari_id
                wrote on last edited by
                #7

                hmm... actually I make an application to mark something on top of a media player so, the main window contains the media player activeX control, and I put transparent modeless dialog on top of it. I wonder how to redraw the player in main window... :confused:

                -Houari

                M 1 Reply Last reply
                0
                • H houari_id

                  hmm... actually I make an application to mark something on top of a media player so, the main window contains the media player activeX control, and I put transparent modeless dialog on top of it. I wonder how to redraw the player in main window... :confused:

                  -Houari

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

                  Check out the InvalidateRect() API to mark a window or windows to be repainted. (Same API used by CWnd::Invalidate() from my original reply) Mark

                  "Do you know what it's like to fall in the mud and get kicked... in the head... with an iron boot? Of course you don't, no one does. It never happens. It's a dumb question... skip it."

                  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