invalidate/paint drops update regions
Posted on 2000-04-04
Any help appreciated:
Not everything I draw into my memory DC is making it into my window. I'm sure it all makes it into the memDC because it all shows up if I force a repaint with minimize, or if I cover/uncover with another window. But without this manual intervention, it looks like OnPaint is dropping a bunch of update rectangles.
Basically, my DrawACircle()-function draws into a memory DC (CDC), and then calls InvalidateRect() with the same coordinates on my CFrameWnd. CMyFrameWnd::OnPaint() calls GetUpdateRect() and then blit's from the memDC to the window's DC. Is this setup "right"? Somewhere in here, if I draw a bunch of stuff right in a row, some of the stuff doesn't get drawn in the window. I loose parts of lines, or if I draw a bunch of partially overlapping circles in a row, a bunch of them will be missing entirely, and/or displayed but only partially.
I tried wrapping DrawACircle() and OnPaint() with a single CCriticalSection object (keeping them from running concurrently), and everything works fine, but I would rather not fill all my DrawAWhatever() functions with Critical Section Lock's and Unlock's. Is there another way to solve this? Even a more articulate description of the problem would be helpful.
Thanks in advance-