读书人

TFrame 对象的 destroy 重写解决方案

发布时间: 2012-02-21 16:26:23 作者: rapoo

TFrame 对象的 destroy 重写
TContractMain = class(TFrame)
.......
public
constructor Create(AOwner: TComponent);Override;

destructor Destroy; override;
end


constructor TContractMain.Create(AOwner: TComponent);
begin
Inherited create(AOwner);

DModule.GetCompanyInfor(cmBox_Company);
end;

destructor TContractMain.Destroy;
begin
showmessage('1');


inherited Destroy;


end;

在使用该 Frame 时 为什么 Destroy 没有执行

[解决办法]
你都没有释放Form3,当然不会执行啦!

Application.CreateForm(TForm3, Form3);
try
Form3.ShowModal;
finally
FreeAndNil(Form3);
end;

读书人网 >.NET

热点推荐