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. Plotting a position cursor using GDI

Plotting a position cursor using GDI

Scheduled Pinned Locked Moved C / C++ / MFC
c++questiongraphicsdata-structures
5 Posts 2 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.
  • R Offline
    R Offline
    rollei35guy
    wrote on last edited by
    #1

    I have a Visual C++/MFC app that plots several graphs based on the same data. On each graph I draw a cursor or position point based on time. This is all done during a 'playback' mode. The cursor/position is being drawn and redrawn correctly but if I switch applications it sometimes leaves a 'stranded' cursor. This is apparenly because only the region that was previously hidden is redrawn. How can I get OnDraw() to refresh the entire client area of the affected window?

    P 1 Reply Last reply
    0
    • R rollei35guy

      I have a Visual C++/MFC app that plots several graphs based on the same data. On each graph I draw a cursor or position point based on time. This is all done during a 'playback' mode. The cursor/position is being drawn and redrawn correctly but if I switch applications it sometimes leaves a 'stranded' cursor. This is apparenly because only the region that was previously hidden is redrawn. How can I get OnDraw() to refresh the entire client area of the affected window?

      P Offline
      P Offline
      palbano
      wrote on last edited by
      #2

      I believe the default call to Invalidate will Invalidate the entire region

      "No matter where you go, there your are." - Buckaroo Banzai

      -pete

      R 1 Reply Last reply
      0
      • P palbano

        I believe the default call to Invalidate will Invalidate the entire region

        "No matter where you go, there your are." - Buckaroo Banzai

        -pete

        R Offline
        R Offline
        rollei35guy
        wrote on last edited by
        #3

        That is correct Invalidate() will cause the entire region to be redrawn. The question, i suppose, is where does one call this function? The OnDraw() function gets called when the window needs to be redrawn but calling Invalidate() here results in a cascade of messages. Carter

        P 1 Reply Last reply
        0
        • R rollei35guy

          That is correct Invalidate() will cause the entire region to be redrawn. The question, i suppose, is where does one call this function? The OnDraw() function gets called when the window needs to be redrawn but calling Invalidate() here results in a cascade of messages. Carter

          P Offline
          P Offline
          palbano
          wrote on last edited by
          #4

          There are several way to do that. One of the simplest would be to set a timer inside OnDraw() when the condition exists. Then in the Timer event handler you can call Invalidate().

          "No matter where you go, there your are." - Buckaroo Banzai

          -pete

          R 1 Reply Last reply
          0
          • P palbano

            There are several way to do that. One of the simplest would be to set a timer inside OnDraw() when the condition exists. Then in the Timer event handler you can call Invalidate().

            "No matter where you go, there your are." - Buckaroo Banzai

            -pete

            R Offline
            R Offline
            rollei35guy
            wrote on last edited by
            #5

            Thanks for the advice, Pete. What I ended up doing is just hiding the cursor in the OnPaint() event. Restoring it after the EndPaint(). Quicker than redrawing the entire form too. Carter

            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