Plotting a position cursor using GDI
-
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?
-
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?
-
I believe the default call to Invalidate will Invalidate the entire region
"No matter where you go, there your are." - Buckaroo Banzai
-pete
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
-
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
-
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
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