var newForm: TForm; begin for i:= 0 to Number do begin newForm := TForm.Create(Self); newForm.name:='form'+inttostr(i); newForm.Caption := 'form'+inttostr(i); end end;
如果属性是一样的,可以用动态数组变量啊。 Form : Array of TForm; FormCount : Integer; 初始化FormCount := 0; 用到的时候, SetLength(Form,FormCount); Inc(FormCount); Form[FormCount-1] := TForm.Create(nil); ......
begin
newForm := TForm.Create(Self);
newForm.Caption := "123";
end
newForm.Caption := "newForm" + IntToStr(i);
begin
for i:= 0 to Number do
begin
newForm := TForm.Create(Self);
newForm.name:='form'+inttostr(i);
newForm.Caption := 'form'+inttostr(i);
end
end;
FormCount : Integer;
初始化FormCount := 0;
用到的时候,
SetLength(Form,FormCount);
Inc(FormCount);
Form[FormCount-1] := TForm.Create(nil);
......
语句1
{$ELSE}
语句2
只有当expression为真时,编译器编译语句1,否则编译语句2
如果是的话可以使用数组。