如何关闭MDI的子窗口,我写form1.close;他就最小化,父窗体开启时,MDI子窗体也自动开启,怎样可以使当点激菜单项时才创建窗体?procedure Tmain_form.N11Click(Sender: TObject);
begin
application.CreateForm(Tloginform,loginform);
loginform.show;
N11.Enabled :=false;
end;
可以给出关闭子窗体的代码?

解决方案 »

  1.   

    procedure Tfrm.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
    Action:=caFree;
    end;procedure Tfrmt.SpeedButton1Click(Sender: TObject);
    begin
    Self.Close;
    end;
      

  2.   

    在MDI Child Form的OnClose事件中写如下代码就可以关闭了
    procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      Action := caFree;
    end;
      

  3.   

    Build
      [Error] findF.pas(33): Undeclared identifier: 'FormClose'
      [Error] findF.pas(33): ';' expected but ')' found
      [Error] findF.pas(40): '.' expected but end of file found
      [Fatal Error] main.pas(39): Could not compile used unit 'findF.pas'
    出现错误~~~~~~~~~~