我给你两个函数:
---------------------------------------------
Function FindChild(FormName: string): TForm;
var
i: integer;
begin
for i:=0 to MDIChildCount-1 do
if MDIChildren.Name=FormName then
begin
result:=MDIChildren;
Exit;
end;
result:=nil;
end;
-------------------------------------------------------
Function OpenForm(ModualName, FormName: string;
FormClass: TFormClass): TForm;
var
Form: TForm;
begin
Form:=FindChild(FormName) as TForm;
if Form<>nil then
begin
Form.BringToFront;
result:=Form;
Exit;
end;
Form:=FormClass.Create(Self) as TForm;
if Form<>nil then
begin
Form.Name:=FormName;
Form.FModualName:=ModualName;
Form.Show;
result:=Form;
Exit;
end;
result:=nil;
end;
-----------------------------------------------