There's no way to "clear" text that you've drawn other than to draw something else over the top. If your background is a solid color then just draw a rectangle of that color (you can work out how big it needs to be by using the DT_CALCRECT
flag with DrawText
). If your background is an image then you need to blit the appropriate area of the image.
Note that drawing the text over the top of itself using the background color (as you suggest) may not work because of ClearType/anti-aliasing.
To answer your second question, no - the DC returned by BeginPaint
is effectively deleted by the call to EndPaint
and so you don't need to (and mustn't) delete it separately.