以下是我的一段代码,不只对你是否有用:<br>procedure TFrmMain.OpenForm(FormClass: TFormClass; var Frm);<br>var Child:TForm;<br>begin<br> if FrmMain.MDIChildCount &gt;0 then<br> begin<br> if MDIChildren[0].ClassType = FormClass then<br> begin<br> MDIChildren[0].BringToFront;<br> MDIChildren[0].SetFocus;<br> Exit;<br> end else<br> begin<br> if Editing then<br> if Application.MessageBox(PChar('您正在进行的 〖'<br> +MDIChildren[0].Caption+'〗 '+#13+<br> '将被关闭! 所有未保存信息将会丢失!'),'警告',<br> MB_OKCANCEL)=ID_OK then<br> MDIChildren[0].Close else<br> Exit else<br> MDIChildren[0].Close;<br> end<br> end;<br> Child := TForm(FormClass.NewInstance);<br> TForm(Frm):= Child;<br> Child.Create(Self);<br> with Child do<br> begin<br> BorderIcons := [];<br> BorderStyle := bsNone;<br> FormStyle := fsMDIChild;<br> WindowState := wsMaximized;<br> KeyPreview := True;<br> Show;<br> end;<br>end;