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 the drawings?

How to clear the drawings?

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

    Dear Everyone; I have got a picture control placed on top of an activex control (web broswer).Just to make th eproblem clearer i had to do some drawings on top of the web browser. I have then subclassed the picture control and overriden its OnPaint() function. I am doing some drawings in the overridden OnPaint(). Now, everytime the user clicks on a button "Draw" a flag is set to TRUE in the overriden OnPaint() and some shapes are drawn. The drawings are done fine :-) I have another button "Clear" that is supposed to clear the previous drawings. How do i clear what i have drawn ?? Thank you :) llp00na

    C J V 3 Replies Last reply
    0
    • L llp00na

      Dear Everyone; I have got a picture control placed on top of an activex control (web broswer).Just to make th eproblem clearer i had to do some drawings on top of the web browser. I have then subclassed the picture control and overriden its OnPaint() function. I am doing some drawings in the overridden OnPaint(). Now, everytime the user clicks on a button "Draw" a flag is set to TRUE in the overriden OnPaint() and some shapes are drawn. The drawings are done fine :-) I have another button "Clear" that is supposed to clear the previous drawings. How do i clear what i have drawn ?? Thank you :) llp00na

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      Call Invalidate and draw nothing in the OnPaint()


      Cédric Moonen Software developer
      Charting control

      L 1 Reply Last reply
      0
      • L llp00na

        Dear Everyone; I have got a picture control placed on top of an activex control (web broswer).Just to make th eproblem clearer i had to do some drawings on top of the web browser. I have then subclassed the picture control and overriden its OnPaint() function. I am doing some drawings in the overridden OnPaint(). Now, everytime the user clicks on a button "Draw" a flag is set to TRUE in the overriden OnPaint() and some shapes are drawn. The drawings are done fine :-) I have another button "Clear" that is supposed to clear the previous drawings. How do i clear what i have drawn ?? Thank you :) llp00na

        J Offline
        J Offline
        John R Shaw
        wrote on last edited by
        #3

        Cédric Moonen is absolutely correct; that is the simplist solution. :-D But since you say you have a picture control placed on top of the other window, why don't you just hide it. The problem with not drawing anything when OnPaint() is called (for the picture control) is that the picture control is still there and it may call a function to erase the background before calling OnPaint(), which would leave an empty blank spot on the screen. Just some thoughts, INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

        L 1 Reply Last reply
        0
        • L llp00na

          Dear Everyone; I have got a picture control placed on top of an activex control (web broswer).Just to make th eproblem clearer i had to do some drawings on top of the web browser. I have then subclassed the picture control and overriden its OnPaint() function. I am doing some drawings in the overridden OnPaint(). Now, everytime the user clicks on a button "Draw" a flag is set to TRUE in the overriden OnPaint() and some shapes are drawn. The drawings are done fine :-) I have another button "Clear" that is supposed to clear the previous drawings. How do i clear what i have drawn ?? Thank you :) llp00na

          V Offline
          V Offline
          Viorel
          wrote on last edited by
          #4

          Maybe for you task is more appropriate to hide your picture control? When you click the Clear button, you can call m_cMyPicture.ShowWindow(SW_HIDE) function for your picture, and when you click the Draw button you can execute m_cMyPicture.ShowWindow(SW_SHOWNA). Now you do not need to check a flag in OnPaint.

          Y L 2 Replies Last reply
          0
          • V Viorel

            Maybe for you task is more appropriate to hide your picture control? When you click the Clear button, you can call m_cMyPicture.ShowWindow(SW_HIDE) function for your picture, and when you click the Draw button you can execute m_cMyPicture.ShowWindow(SW_SHOWNA). Now you do not need to check a flag in OnPaint.

            Y Offline
            Y Offline
            yogendra kaushik
            wrote on last edited by
            #5

            hi dear i am sorry i put my problem but u dont ans me so plz tel me result for this cn u send me an example as i easily undestand i hav three dialog boxes third dialog box contain menu i want that when i goto third dialog box from first dialog box then its menu are disabled but when i go from second dialog box third dialog box menues are not disabled. plz send me code how to do it note : specially for viorel Please mail me

            1 Reply Last reply
            0
            • J John R Shaw

              Cédric Moonen is absolutely correct; that is the simplist solution. :-D But since you say you have a picture control placed on top of the other window, why don't you just hide it. The problem with not drawing anything when OnPaint() is called (for the picture control) is that the picture control is still there and it may call a function to erase the background before calling OnPaint(), which would leave an empty blank spot on the screen. Just some thoughts, INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

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

              Thanx alot, Cedric Moonen' suggestion was n't giving me the right result. It's exactly how u explained it. I had the background erased everytime Invalidate was called. Hiding the control worked much better. llp00na

              1 Reply Last reply
              0
              • V Viorel

                Maybe for you task is more appropriate to hide your picture control? When you click the Clear button, you can call m_cMyPicture.ShowWindow(SW_HIDE) function for your picture, and when you click the Draw button you can execute m_cMyPicture.ShowWindow(SW_SHOWNA). Now you do not need to check a flag in OnPaint.

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

                Thanx very much for the code. It really helped alot, hiding the control was the trick. But i still need flag in OnPaint() because the drawings are only done when the user requests. llp00na

                1 Reply Last reply
                0
                • C Cedric Moonen

                  Call Invalidate and draw nothing in the OnPaint()


                  Cédric Moonen Software developer
                  Charting control

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

                  thanx for your reply; I used your approach. However i had the background (the web browser) erased evrytime Invalidate is called. So i did what guys suggested (hiding the control). cheers llp00na

                  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