procedure TForm1.Button1Click(Sender: TObject);//新form1_1
begin
try
if myform=nil then
begin
myform:=tform1.Create(application);
myform.Button4.Visible :=false;
myform.Show();
end;
finally
end;
end;
procedure TForm1.Button2Click(Sender: TObject);//释放资源
begin
myform.Free;
myform:=nil;
end;
procedure TForm1.Button3Click(Sender: TObject);//遍历form
var
i:integer;
begin
for i:=1 to application.componentcount-1 do
begin
showmessage(application.components.name);
end
end;
主要是通过隐含的application的componentcount和components属性访问form
以上代码很粗糙,只是演示,先动态创建另一个form在遍历,缺省下有form1和
form1_1.