如何关闭MDI窗口下的子窗口?请写的详细点,我初学

解决方案 »

  1.   

    在FORM窗体的ONCLOSE事件中加入下面代码:即 action := caFree;
    procedure TFrmBase.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
        action := cafree;
    end;
      

  2.   

    子窗口的onclose事件中加入:
    action:=cafree;即可。
      

  3.   

    双击子窗体的onClose写如下代码:
     Action:=Cafree;
    搞定!
      

  4.   

    procedure Tfm_user.FormDestroy(Sender: TObject);
    begin
      DM.ADOTab_user.Active:=False;
      fm_user:=nil;
    end;procedure Tfm_user.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      action:=cafree;
    end;procedure Tfm_user.exitClick(Sender: TObject);
    begin
      inherited;
      close;
    end;
      

  5.   

    mainform.ActiveMDIChild.Close;//关闭当前子窗体
      

  6.   

    如果要完全清楚的话,各位忽略了一点:YourMDIForm:=Nil;
    不这样的话,有时候会出现莫名其妙的错误