Hello!

How to draw rectangle in Delphi (using timer component).
Thanx!

Nopop.

Draving line in Delphi (using Timer component):

var x1,x2,y1,y2:integer;
t:extendet;

procedure TForm1.Button1Click(Sender: TObject);
begin
 timer14.enabled:=true;
 x1:=10; x2:=100;
 y1:=100; y2:=140;
 t:=0;
end;

Pocedure TForm1.Timer1Timer(Sender: TObject;
var x,y:integer;
begin
if t<=1 then
begin
  c:=round((1-t)*x1+t*x2);
  y:=round((1-t)*y1+t*y2);
  PaintBox1.Canvas.Pixels[x,y]:=clWhite;
  t:=t+0.01;
 end
else
 timer1.enabled:=false;
end

bat how draw rectangle? :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.