Normally you invalidate the area (e.g. via InvalidateRect
) and let your WM_PAINT
handler repaint it. Reasons why you would get flicker often are because you haven't overridden the WM_ERASEBKGND
handler, your WM_PAINT
handler isn't doing double-buffered painting, or you're invalidating (or repainting) an area larger than you need to.
This page might help: Flicker-free Drawing: Techniques to eliminate flicker from your applications