Mega Code Archive

 
Categories / Delphi / Examples
 

Flicker free drawing

Flickering is bad, here is how to eliminate it. When creating components, you sometimes need to constantly redraw your component for animation effects etc. The problem is that the surface you are drawing to is visible, so the user can actually watch the component being drawn. The solution is to have your own procedure for drawing the Component's image to an offscreen canvas, which you then DRAW to its canvas. You simly call this procedure every time you want to update the appearence of your component without invalidating, and you can still call this procedure from Paint. If you just want an existing form / panel to stop flickering, try setting Panel1.DoubleBuffered := True;