redraw
I have to update what I draw.But when I draw again I can see behind what I have drawn before if this is bigger.How can I erase before redrawing?
I have used invalidaterect and validaterect but it doesnt work.
[217 byte] By [
anitai] at [2007-11-18 1:40:30]

# 1 Re: redraw
MSDN said that to CWnd::InvalidateRect()
If bErase is TRUE, the background is erased when the BeginPaint member function is called.
if it does not work well you may consider another way. To pain the rectangle with background color.
hope it helps.
sm_ch at 2007-11-10 8:54:12 >

# 2 Re: redraw
Invalidate & invalidaterect cause a WM_PAINT msg to be dispatched, handled by the OnPaint method, which is where you should be drawing. *** NOTE <<there are other methods like DrawItem where drawing is done, and you're not necassarily limited to drawing in the OnPaint>>
You can have the system automatically erase the window space by specifing the bErase param to TRUE (default value) as noted in a previous response. Somtimes this causes a "flickering" effect, so often programmers will override the OnEraseBkgnd method to return a non-zero value, which stops the framework from filling the window rect with the background color. If you do this, you should "erase" any previous drawing that is not covered by the current drawing.
There are several ways of doing this, you can intersect the invalid rgn with the rgn/rect you're going to draw in and fill that with the backgrnd color, you could store the previous bounding rect of what was drawn before and fill the areas that are not covered by the current bounding rect...
bytz at 2007-11-10 8:55:11 >
