//采用Panel procedure TForm1.FormCreate(Sender: TObject); var i, j: integer; begin j := 0; for i := 0 to 5 do begin with TPanel.Create(nil) do begin Parent := Panel1; Name := 'Panel' + IntToStr(i); width := 80; Height := 20; if (i + 1) * 80 > Panel1.Width then begin Left := 0; inc(j); end else Left := i * 80; Top := j * 20; end; end; end; //在Form上先加一個Panel
procedure TForm1.FormCreate(Sender: TObject);
var
i, j: integer;
begin
j := 0;
for i := 0 to 5 do
begin
with TPanel.Create(nil) do
begin
Parent := Panel1;
Name := 'Panel' + IntToStr(i);
width := 80;
Height := 20;
if (i + 1) * 80 > Panel1.Width then
begin
Left := 0;
inc(j);
end
else
Left := i * 80;
Top := j * 20;
end;
end;
end;
//在Form上先加一個Panel