unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
Timer1: TTimer;
Box: TPaintBox;
{ 600x400 !!}
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Y: Integer;
buf: TBitmap;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
var
X: Integer;
begin
Y := Y + 5;
X := Y*3
DIV 2;
with buf.Canvas
do
begin
Pen.Color := clWhite;
Rectangle(0,0,600,400);
Pen.Color := clBlack;
Rectangle(300-X,200-Y,300+X,200+Y);
{ Second Box }
if (Y-100) > 0
then
begin
X := (Y-100)*3
DIV 2;
Rectangle(300-X,200-(Y-100),300+X,200+(Y-100));
end;
{ /Second Box }
MoveTo(0,0);
LineTo(600,400);
MoveTo(600,0);
LineTo(0,400);
end;
if Y > 200
then
Y := 100;
Box.Canvas.Draw(0,0,Buf);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Y := 100;
buf := Tbitmap.Create;
buf.Height := 400;
buf.Width := 600;
end;
end.