这是我自己建立的一个函数:
procedure OpenForm(FormClass: TComponentClass; var Reference);
var
i,n:integer;
myForm: TComponent;
begin
i:=0;
myForm := TComponent(FormClass.NewInstance);
for n:=0 to application.MainForm.MDIChildCount-1 do
begin
if Application.MainForm.MDIChildren[n].ClassName=myForm.ClassName then i:=i+1
end;
if i=0 then
begin
(myForm as TForm).Free;
Application.CreateForm(FormClass,Reference);
(myForm as TForm).Show;
end else
begin
(myForm as TForm).BringToFront;
end;
end;
可检测指定FORM是否已经建立,但却做不到将已建立的FORM激活及置上。