TPageControl控件,两个page之间不能插入一个new page的啊?初学只知道能delete page。不知道在两个page之间怎么再插入一个newpage。大伙给点操作步骤。谢谢了

解决方案 »

  1.   

    已经有两个TabSheet,假设为tsA,tsB,其TabIndex分别为0,1,然后新建立一个TabSheet,假设为tsC,此时该tsC的TabIndex应该为2。
    设置tsC的TabIndex为1,tsB的TabIndex为2,这时候在PageControl上TabSheet的顺序就是tsA、tsC、tsB啦,相当于在tsA、tsB中新插入了一个tsC。
      

  2.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Tabs, ComCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        PageControl1: TPageControl;
        TabSheet1: TTabSheet;
        TabSheet2: TTabSheet;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    var
      TabSheet : TTabSheet;
    begin
      TabSheet := TTabSheet.Create(PageControl1);
      TabSheet.PageControl := PageControl1;
      TabSheet.Caption := 'Test Insert';
      TabSheet.PageIndex := 1;
    end;end.object Form1: TForm1
      Left = 226
      Top = 155
      Width = 870
      Height = 640
      Caption = 'Form1'
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      OldCreateOrder = False
      PixelsPerInch = 96
      TextHeight = 13
      object Button1: TButton
        Left = 184
        Top = 320
        Width = 75
        Height = 25
        Caption = 'Button1'
        TabOrder = 0
        OnClick = Button1Click
      end
      object PageControl1: TPageControl
        Left = 288
        Top = 224
        Width = 289
        Height = 193
        ActivePage = TabSheet2
        TabOrder = 1
        object TabSheet1: TTabSheet
          Caption = 'TabSheet1'
        end
        object TabSheet2: TTabSheet
          Caption = 'TabSheet2'
          ImageIndex = 1
        end
      end
    end