Skip to main content
2 de 2
formato código
Sorack
  • 26,5mil
  • 6
  • 43
  • 96

Veja isso:

procedure TForm13.Button1Click(Sender: TObject);
Var
   tabSheet: TTabSheet;
   AComponent: TComponent;
   aIndex: Integer;
begin
   aIndex:=-1;

   AComponent := FindComponent('TabSheet1');
   if Assigned(AComponent) then
     if AComponent is TTabSheet then
       aIndex := TTabSheet(AComponent).PageIndex; //get the index of the 'TabSheet1'  

   tabSheet := TTabSheet.Create(PageControl1);
   tabSheet.PageControl := PageControl1;
   tabSheet.Caption := 'My TabSheet'+IntToStr(PageControl1.PageCount);
   if aIndex>-1 then
     tabSheet.PageIndex := aIndex; //Set the index of the new TabSheet
end;