多标签窗体的释放一法

将释放写在子窗体的FORMCLOSE()里面

procedure TFormLogin.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
  FormLogin := nil;
end;

 

关闭TABSHEET的时候,遍历找到它里面的窗体,然后调用窗体的close()方法

procedure TFormMain.CloseTabsheet;
var
  i: Integer;  
begin
  if RzPageControl1.PageCount <= 0 then Exit;
  if RzPageControl1.ActivePage = nil then exit;
  for i := 0 to RzPageControl1.ActivePage.ControlCount - 1 do
    if RzPageControl1.ActivePage.Controls[i] is TForm then
    begin
      TForm(RzPageControl1.ActivePage.Controls[i]).Close;
      Break;
    end;
  RzPageControl1.ActivePage.PageControl := nil;
  RzPageControl1.ActivePage.Free;
  RzPageControl1.SelectNextPage(true);
end;

posted @ 2010-08-14 14:27  delphi中间件  阅读(440)  评论(0编辑  收藏  举报