Using Windows Vista Built-In Double Buffering
The solution to fixing flickering issues when drawing graphics is to use double buffering. Double buffering basically means that an off-screen buffer is created. Everything is rendered to this off-screen buffer and, when drawing is completed, this off-screen buffer is copied to the screen. The end result is that you do not see any flickering and you do not see the drawing being created part by part. A little unknown fact is that Windows Vista has built-in support for double buffering, so managing off-screen buffers, copying data, and so forth are all managed by Windows for you. I wrote an article including an example on how to use this built-in support for double buffering with C++. This article has been published on CodeGuru.