unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, StdCtrls;
type
TForm1 = class(TForm)
PageControl1: TPageControl;
Add: TButton;
Delete: TButton;
procedure AddClick(Sender: TObject);
procedure DeleteClick(Sender: TObject);
private
{ Private declarations }
TabSheet1: TTabSheet;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.AddClick(Sender: TObject);
begin
TabSheet1 := TTabSheet.Create(PageControl1);
TabSheet1.Caption :='1';
TabSheet1.PageControl := PageControl1;
TabSheet1.Visible := True;
end;
procedure TForm1.DeleteClick(Sender: TObject);
var
i: Integer;
ts: TTabSheet;
begin
for i := PageControl1.PageCount - 1do
wnto 0do
begin
ts := PageControl1.Pages;
ts.PageControl := nil;
ts.Free;
end;
end;
end.