unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Button2: TButton;
Shape1: TShape;
Panel1: TPanel;
procedure Button2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
shape_array :
array [1..18]
of TShape
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
shape_array [1].Free;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
shape_array [11] := Tshape.Create(Panel1);
with shape_array [11]
do
begin
parent := Panel1;
left := 1;
top := 1;
Height := 30;
width := 30;
shape := stCircle;
brush.Color := clWhite;
end;
end;
procedure TForm1.FormActivate(Sender: TObject);
var i : integer;
begin
for i := 1
to 10
do
begin
shape_array [i] := TShape.Create(self);
with shape_array [i]
do
begin
parent := self;
left := 10*i;
top := 10;
Height := 10;
width := 10;
shape := stCircle;
brush.Color := clWhite;
end;
end;
end;
end.