unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ShellAPI; type TForm1 = class(TForm) Timer1: TTimer; procedure Timer1Timer(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } prostokat1: TRect; prostokat2: TRect; x1:Integer; x2:Integer; y1:Integer; y2:Integer; x3:Integer; x4:Integer; y3:Integer; y4:Integer; end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Timer1Timer(Sender: TObject); begin Canvas.Brush.Color:=clDefault; // Canvas.FillRect(prostokat2); //Usun stary kwadrat2 Canvas.Brush.Color:=clDefault; // Canvas.FillRect(prostokat1); //Usun stary kwadrat1 prostokat1:=Rect(x1,y1,x2,y2); Canvas.Brush.Color:=clWhite; Canvas.FillRect(prostokat1); //nowy kwadrat1 prostokat2:=Rect(x3,y3,x4,y4); Canvas.Brush.Color:=clRed; Canvas.FillRect(prostokat2); //nowy kwadrat2 x1:=x1+1; x2:=x2+1; y3:=y3+1; y4:=y4+1; //inkeremntacja if y4>ClientHeight-10 then begin y3:=10; y4:=20; x3:=x3-10; x4:=x4-10; end; if x1>ClientWidth-10 Then begin x1:=10; x2:=20; y1:=y1+10; y2:=y2+10; end; if (y2>y3 AND y1