[ Home | FAQ | OCX Book | Sites ]
How can I eliminate "flicker" in my graphical controls?
The quickest and easiest way to eliminate flicker when a control requires repeated drawing, is to use an off screen device context (DC) and bitmap. The gist of the process is that to eliminate flicker from the drawing process, you perform all of the control drawing operations in a memory-based DC. After this has been completed, the contents of the DC are bit-blt'ed (Bit Block Transferred) to the actual screen-based DC. The speed of the bit-blt removes any discernible flicker from the drawing process. One of the tricky aspects of this approach, is handling the metafile representation of your control. The details of how to implement memory-based DC drawing are detailed in Chapter 9 of my book. The Chapter 9 CLOCK.OCX example uses the various techniques to achieve flicker free drawing. See these resources for details.
Typical Disclaimer: This FAQ is copyright (c) 1996 by Tom Armstrong. You have the right to copy and distribute this file in any way you see fit as long as this paragraph is included with the distribution. No warranties or claims are made as to the validity of the information contained herein. So use it at your own risk