TTabbedNotebook控件

访问标签页所属控件
TWinControl(TabbedNotebook.Pages.Objects[pageIndex]).Controls[i]
运行时增加标签页
var
  btnNew : TButton;
  NewPage: TTabPage;
  wNumber: Word;
begin
  { Create the new TTabPage object }
  NewPage := TTabPage.Create(Application);
  { The page must be a child of the notebook }
  TabbedNotebook1.InsertControl(NewPage);
  { Add text to the notebook’s Pages property.
    This will cause the new page to be added as
    the last tab on the notebook }
  wNumber := TabbedNotebook1.Pages.Add(’New Page’);
  TabbedNotebook1.PagesObjects[wNumber] := NewPage;
  { The page needs controls on it; here’s how to add one }
  btnNew := TButton.Create(Self);
  TWinControl(TabbedNotebook1.Pages.Objects[wNumber]).InsertControl(btnNew);
  with btnNew do
  begin
    Top := 10;
    Height := 30;
    Width := 100;     
    Caption := ‘OK’;
  end;
end;

引用: How Can I Add Pages to a TTabbedNotebook at Run-time?

你可能感兴趣的:(.net)