文件名称:Delphi 中的自动释放策略
文件大小:15KB
文件格式:TXT
更新时间:2016-04-23 08:04:26
自动释放
一、指定 Owner 后, 随 Owner 连带释放: -------------------------------------------------------------------------------- //uses Vcl.StdCtrls, Vcl.ExtCtrls; var panel: TPanel; procedure TForm1.Button1Click(Sender: TObject); begin panel := TPanel.Create(Self); panel.Parent := Self; with TButton.Create(panel) do //AOwner = panel begin Parent := panel; Caption := 'New Button'; end; end;