给个通用过程,不管是不是MDI窗体都行<br>procedure OpenForm(FormClass: TFormClass; var AForm;<br> AOwner:TComponent=nil);<br>//根据窗口类名建立窗口,如果窗口存在则只激活它<br>var<br> i: integer;<br> Child:TForm;<br>begin<br> for i := 0 to Screen.FormCount -1 do<br> if Screen.Forms.ClassType=FormClass then<br> begin<br> Child:=Screen.Forms;<br> if Child.WindowState=wsMinimized then<br> Child.WindowState:=wsNormal;<br> Child.BringToFront;<br> Child.Setfocus;<br> TForm(AForm):=Child;<br> exit;<br> end;<br> Child:=TForm(FormClass.NewInstance);<br> TForm(AForm):=Child;<br> if not assigned(aowner) then aowner:=application;<br> Child.Create(AOwner);<br>end;<br>建立用<br>OpenForm(Tydcx_frm,ydcx_frm,self);<br>窗口关闭还是<br>procedure Tydcx_frm.FormClose(Sender: TObject; var Action: TCloseAction);<br>begin<br> action:=cafree;<br>end; <br>