如何在父窗体中规范的显示子窗体?
procedure show_form(var new_form:TForm;new_Class:TFormClass);
begin
if assigned(new_form) then
begin
new_form.BringToFront;
end else
begin
new_form := new_Class.Create(Application.MainForm);
new_form.FormStyle :=fsMDIChild;
new_form.Visible :=True ;
new_form.WindowState :=wsMaximized;
new_form.Show;
end;
end;
程序中除了父窗体的formstyle是fsMDIForm外,其他窗体的formstyle默认都是fsNormal。
在父窗体中用上面通用过程调用时显示正常,但是在关闭程序时,如果不关闭子窗体,直接关闭父窗体,
会经常弹出下面错误。(如逐一关闭子窗体,最后关闭父窗体就不会报错)
project hmmt.exe raised exception class einvalidopenation whit message
' cannot create form. no mdi forms are currently active'。
有什么解决办法?