所有mdi表格关闭时的事件

Del*_*man 7 forms delphi events mdi

伙计们,如果有人知道在所有MDI表格关闭时我可以截获的任何事件或方法,我想.

例:

我想在我的主窗体中实现一个事件,当我关闭所有MDI表单时,触发了这样的事件.

如果有人可以帮忙,感激不尽.

Ser*_*yuz 8

MDI子表单(实际上是任何表单)在被销毁时将通知主表单.您可以使用此通知机制.例:

type
  TForm1 = class(TForm)
    ..
  protected
    procedure Notification(AComponent: TComponent; Operation: TOperation);
      override;

  ..

procedure TForm1.Notification(AComponent: TComponent; Operation: TOperation);
begin
  inherited;
  if (Operation = opRemove) and (AComponent is TForm) and
      (TForm(AComponent).FormStyle = fsMDIChild) and
      (MDIChildCount = 0) then begin

    // do work

  end;
end;
Run Code Online (Sandbox Code Playgroud)