CJBK_View::OnDraw(CDC* p_DC)
-
I am trying to use the "OnDraw" message to respond to the left mouse button click. The "Button Up" triggers ->Invalidate(TRUE); and -> UpdateWindow(); which then calls "OnDraw". Once "OnDraw" is called, a long series of graphics functions are used to draw what I want to display, using the DC supplied by "OnDraw". This all works and draws what I want, however: "OnDraw" seems to be called 3 consecutive times, each with a different DC for the same hwnd. This causes the graphics (which don't change) to be calculated and drawn 3 times producing an annoying flicker and waste of application processing time. Is there a way to get just one call to "OnDraw"? WM_PAINT seems to also be sent 3 times. Any suggestions to different methods or approaches will be welcome. Thanks and Happy Thanksgiving to those who celebrate. Barry :confused:
-
I am trying to use the "OnDraw" message to respond to the left mouse button click. The "Button Up" triggers ->Invalidate(TRUE); and -> UpdateWindow(); which then calls "OnDraw". Once "OnDraw" is called, a long series of graphics functions are used to draw what I want to display, using the DC supplied by "OnDraw". This all works and draws what I want, however: "OnDraw" seems to be called 3 consecutive times, each with a different DC for the same hwnd. This causes the graphics (which don't change) to be calculated and drawn 3 times producing an annoying flicker and waste of application processing time. Is there a way to get just one call to "OnDraw"? WM_PAINT seems to also be sent 3 times. Any suggestions to different methods or approaches will be welcome. Thanks and Happy Thanksgiving to those who celebrate. Barry :confused:
-
I am trying to use the "OnDraw" message to respond to the left mouse button click. The "Button Up" triggers ->Invalidate(TRUE); and -> UpdateWindow(); which then calls "OnDraw". Once "OnDraw" is called, a long series of graphics functions are used to draw what I want to display, using the DC supplied by "OnDraw". This all works and draws what I want, however: "OnDraw" seems to be called 3 consecutive times, each with a different DC for the same hwnd. This causes the graphics (which don't change) to be calculated and drawn 3 times producing an annoying flicker and waste of application processing time. Is there a way to get just one call to "OnDraw"? WM_PAINT seems to also be sent 3 times. Any suggestions to different methods or approaches will be welcome. Thanks and Happy Thanksgiving to those who celebrate. Barry :confused:
This solved the problem. Thanks. Just under what conditions would one call ->UpdateWindow?:cool:
Barry
-
This solved the problem. Thanks. Just under what conditions would one call ->UpdateWindow?:cool:
Barry
The documentation[^] explains what the function does, and suggests that it should be called immediately after a Window is created. This has always been my understanding, and the remainder of the time you just use
InvalidateRect
orInvalidateRgn
to queue the redrawing messages.Veni, vidi, abiit domum