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. Erase previous drawings

Erase previous drawings

Scheduled Pinned Locked Moved C / C++ / MFC
14 Posts 4 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.
  • L llp00na

    Hi I have got the following code: Code: drawDATA(Shapes shapes, CDC& cd){ // select pen ... ect // draw shapes cd.TextOut(X, Y, "DRAW1"); } I am calling drawDATA from two methods drawA, drawB with: CClientDC dc(this) as parameter. drawA(shapesA, dc); --> if user invokes action A Invalidate() drawB(shapesB, dc); --> if user invokes action B Invalidate(); both methods draw the shapes, but I only want to show the latest shapes not both shapes of A and B. If user clicks button A then i should show him shapes A If he clicks Button B then I should show him shapes B. If he clicks A , I should show shapes A first, and he continues and clicks B, I should erase shapes A and show shapes B only SO iI need a way of erasing previous shapes thank

    llp00na

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

    Try RedrawWindow[^] instead of Invalidate...

    > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

    L 1 Reply Last reply
    0
    • L llp00na

      I am drawing on top of a web browser control So cant use the background colour I tried UpdateWindow() but does not work

      llp00na

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #5

      UpdateWindow just sends the WM_PAINT message to your app, it doesn't actually cause painting to happen. basically painting happens whenever your app has nothing else to do and your app gets around to processing the WM_PAINT message. that's not going to happen in the middle of a function (unless you're doing something like an old-school Message Pump between statements). but, basically, there is no "erase" functionality. there is only draw. if you need to erase drawing A, you have to draw what was there before you drew A.

      batch image processing

      1 Reply Last reply
      0
      • C Code o mat

        Try RedrawWindow[^] instead of Invalidate...

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

        L Offline
        L Offline
        llp00na
        wrote on last edited by
        #6

        How do i force a web browser control to redraw itself?

        llp00na

        L D 2 Replies Last reply
        0
        • L llp00na

          How do i force a web browser control to redraw itself?

          llp00na

          L Offline
          L Offline
          llp00na
          wrote on last edited by
          #7

          that did not work

          llp00na

          1 Reply Last reply
          0
          • L llp00na

            How do i force a web browser control to redraw itself?

            llp00na

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #8

            Are you using IWebBrowser2?

            "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            L 1 Reply Last reply
            0
            • D David Crow

              Are you using IWebBrowser2?

              "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              L Offline
              L Offline
              llp00na
              wrote on last edited by
              #9

              Yes

              llp00na

              D 1 Reply Last reply
              0
              • L llp00na

                Yes

                llp00na

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #10

                Can you call it's Refresh() or Refresh2() method?

                "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                L 1 Reply Last reply
                0
                • D David Crow

                  Can you call it's Refresh() or Refresh2() method?

                  "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  L Offline
                  L Offline
                  llp00na
                  wrote on last edited by
                  #11

                  I have tried Refresh() But it erases everything, even those created after Refresh is called drawShapesA Refresh() drawShapesB

                  llp00na

                  D 1 Reply Last reply
                  0
                  • L llp00na

                    I have tried Refresh() But it erases everything, even those created after Refresh is called drawShapesA Refresh() drawShapesB

                    llp00na

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #12

                    Are you changing the HTML that the IWebBrowser2 control is rendering?

                    "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    L 1 Reply Last reply
                    0
                    • D David Crow

                      Are you changing the HTML that the IWebBrowser2 control is rendering?

                      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                      L Offline
                      L Offline
                      llp00na
                      wrote on last edited by
                      #13

                      No I am not

                      llp00na

                      1 Reply Last reply
                      0
                      • L llp00na

                        I am drawing on top of a web browser control So cant use the background colour I tried UpdateWindow() but does not work

                        llp00na

                        D Offline
                        D Offline
                        David Crow
                        wrote on last edited by
                        #14

                        llp00na wrote:

                        I am drawing on top of a web browser control

                        Which means that anytime the Web browser control redraws itself, anything drawn on top of it goes away.

                        "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                        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