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. Clear text from a device context.

Clear text from a device context.

Scheduled Pinned Locked Moved C / C++ / MFC
question
24 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.
  • M Mark Salsbery

    Your code works for me. In OnTimer(), I had to change InvalidateRect(rTextRect); to InvalidateRect(&rTextRect); Mark

    Mark Salsbery Microsoft MVP - Visual C++ :java:

    M Offline
    M Offline
    Mr Simple
    wrote on last edited by
    #21

    Mark Salsbery wrote:

    Your code works for me.

    Really??? :wtf: I have tried both but I still get the smudge either way (I have only tested on XP).

    M 1 Reply Last reply
    0
    • M Mr Simple

      Mark Salsbery wrote:

      Your code works for me.

      Really??? :wtf: I have tried both but I still get the smudge either way (I have only tested on XP).

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

      Yes, really :) The change I made wasn't even necessary, since CRect has a LPRECT operator. I'm testing on Vista. Is it leaving a trail of pixels or does the entire text get left behind on previous draws? Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      M 1 Reply Last reply
      0
      • M Mark Salsbery

        Yes, really :) The change I made wasn't even necessary, since CRect has a LPRECT operator. I'm testing on Vista. Is it leaving a trail of pixels or does the entire text get left behind on previous draws? Mark

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        M Offline
        M Offline
        Mr Simple
        wrote on last edited by
        #23

        The entire text gets left behind (in the image below I have used 'rTextRect.OffsetRect(0, 20);' to space them out a bit to show this). http://i19.tinypic.com/8a4gh2w.jpg Thanks MS.

        M 1 Reply Last reply
        0
        • M Mr Simple

          The entire text gets left behind (in the image below I have used 'rTextRect.OffsetRect(0, 20);' to space them out a bit to show this). http://i19.tinypic.com/8a4gh2w.jpg Thanks MS.

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

          Hmm that shouldn't happen :) WM_ERASEBKGND should redraw the background for the invalidated rect when the CPaintDC is created (during the internal call to BeginPaint(). Can you add a WM_ERASEBKGND that calls the base class method? Then in that handler, maybe draw a rectangle at the textrect. Mark

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          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