Чтобы линия не затиралась объектом Shape, можно поступать по-разному... Можно линию отрисовывать не на Canvas формы, а, например, на прозрачном TImage (со всеми последствиями). А можно (предпочтительнее) на отдельном Bitmap в памяти, который затем отрисовывать на Canvas'е. Вот как-то так, наверное:
Код:
var
Form1: TForm1;
t: real;
Bmp: TBitmap;
..................
procedure TForm1.Timer1Timer(Sender: TObject);
begin
t := t + Timer1.Interval/1000;
Shape1.Top := round(50*sin(t))+300;
Shape1.Left := round(50*cos(t))+300;
Application.ProcessMessages;
Bmp.Canvas.LineTo(Shape1.Left + Shape1.Width shr 1,
Shape1.Top + Shape1.Height shr 1);
Canvas.Draw(0, 0, Bmp);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
t := 0;
Bmp := TBitmap.Create;
Bmp.Width := ClientWidth; Bmp.Height := ClientHeight;
Bmp.Transparent := True;
Shape1.Top := round(50*sin(t))+300;
Shape1.Left := round(50*cos(t))+300;
Bmp.Canvas.MoveTo(Shape1.Left + Shape1.Width shr 1,
Shape1.Top + Shape1.Height shr 1);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Bmp.Free;
end;