Delphi TTabControl控件使用

时间:2021-04-22 17:35:51

Delphi TTabControl控件使用

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls;

type
  TForm1 = class(TForm)
    tbc1: TTabControl;
    btn1: TButton;
    btn2: TButton;
    btn3: TButton;
    procedure btn3Click(Sender: TObject);
    procedure btn2Click(Sender: TObject);
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btn3Click(Sender: TObject);
begin
  tbc1.Tabs.Insert(2,'插入Tab');
end;

procedure TForm1.btn1Click(Sender: TObject);
begin
  tbc1.Tabs.Delete(1);
end;

procedure TForm1.btn2Click(Sender: TObject);
begin
  tbc1.Tabs.Add('新增Tab');
end;

end.