Get animation to not blit
Posted on 1997-07-31
I have a TBitmap (Bitmap1) that I move around a TForm (Form1).
I use a TTimer (Timer1) to control the move of Bitmap1 and the repaint of the Form1. The only things I do in the OnTimer-event of Timer1 is to change the variabels that defines the position of Bitmap1 and afterward call the Repaint-methode of the Form1:
procedure TForm1.Timer1Timer(Sender: TObject);
if X < 200 then X := X + 1
else X := 0;
I then have a OnPaint-event connected to Form1. I makes sure that Bitmap1 is drawn onto Form1's canvas before repainting:
procedure TForm1.FormPaint(Sender: TObject);
I all works fine, but the updating of Form1 makes it blink. I guess it is because vertical retrace is not going on when I repaint my Form1.
Is there a way to wait for vertical retrace before repainting or can any of you help me lose the blinking in some way?
Thanx - Steff