One can find several examples for flicker free drawing in MFC. (see for example Flicker Free Drawing In MFC)
Here is an example done by myself. I used the CMemDC Class posted in Enhanced CMemDC.
The example code for download:
FlickerFreeDemoBackground.zip (27,7 KiB)
What is the magic? We need to make sure, that the background of our window is not painted when OnPaint is called. For that we need to...