5,392
社区成员
发帖
与我相关
我的任务
分享
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
LblArray : Array[1..100] of TLabel;
edtArray : Array[1..100] of TEdit;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
begin
for i := 0 to 10 do
begin
LblArray[i] := TLabel.Create(nil);
LblArray[i].Name := 'lbl'+IntToStr(i);
LblArray[i].Caption := IntToStr(i)+':';
LblArray[i].Left := 48;
LblArray[i].Top := 24+i*64;
LblArray[i].Visible := true;
LblArray[i].Show;
LblArray[i].parent := panel1;
EdtArray[i] := Tedit.Create(nil);
EdtArray[i].Name := 'edt'+IntToStr(i);
EdtArray[i].Left := 48;
EdtArray[i].Top := 48+i*64;
EdtArray[i].Visible := true;
EdtArray[i].Show;
EdtArray[i].parent := panel1;
end;
end;
end.