delphi TOnFormVisibleChangeEvent 事件应用

TGQIFileMgrForm = class(TForm)

定义

property OnVisibleChange: TOnFormVisibleChangeEvent read FOnVisibleChange write FOnVisibleChange;

在另一个窗体中  把上面的窗体定义成自己变量

FCADFileMgrFrm: TGQIFileMgrForm;

创建

  

// 创建图纸管理窗体
FCADFileMgrFrm := TGQIFileMgrForm.Create(Self, FProject, FSceneViewer, FCADLayerFrm.tvCADLayersTreeView);
FCADFileMgrFrm.Visible := False;
FCADFileMgrFrm.OnVisibleChange := DoOnCADFileMgrFrmVisibleChange;
FCADFileMgrFrm.OnExecuteCommand := Execute;
FCADFileMgrFrm.gvdFloorMapinfoGrid.OnDblClick := FloorChange;
UiService.FormCenter.RegisterForm(FCADFileMgrFrm, AModuleID);

在那个窗体中实现方法 DoOnCADFileMgrFrmVisibleChange



procedure TGAEAModelInputForm.DoOnCADFileMgrFrmVisibleChange;
begin
if FCADFileMgrFrm.GettsOriginalImageListVisible then
FCommandEnabledController.RefreshActionEnabled;
end;

这样 TGQIFileMgrForm 的定义的事件和 TGAEAModelInputForm就关联起来了

原文地址:https://www.cnblogs.com/zhangzhifeng/p/7457918.html