開啟子窗口 的疑問(在d7中)
procedure TForm1.openchild(AForm: TForm;AFormClass: TFormClass;childcaption:string);
var
i:integer;
begin
for i:=0 to application.ComponentCount-1 do
begin
if (application.Components[i] is AFormClass) then//加?一句。
begin
if (application.Components[i] as tform).Caption=childcaption then
begin
(application.Components[i] as tform).Show;
exit;
end
else begin
aform:=AFormClass.create(self);
aform.show;
end;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
openchild(form2,tform2,'form2');
end;
不報錯﹐也不顯示
問﹕該怎么修改