Double buffering in delphi
delphi
Solution
Set `Form1.DoubleBuffered` to `True`. You can do this in code, but I think the property is published in XE2, so you can set it in the Object Inspector as well.
Problem
Using Delphi XE2 I wanted to make some buttons move in delphi application. I wrote this code: ``` procedure TForm1.DoSomething; var x : integer; begin for x := 200 downto 139 do begin // move two buttons Button1.Top := x; Button3.Top := x; // skip some repaints to reduce flickering if (x mod 7 = 1) then begin Form1.Repaint; Sleep(50); end; end; ``` Unfortunately it still significantly flickers when running this procedure. Here's my question: Is there any way, to make the animation smooth (without any flickering)? Edit: To make animation more smooth, change 50 to something smaller in sleep(50) and delete this line: ``` if(x mod 7 = 1) then begin ```