• Delphi 之 TPageControl组件


    TPageControl组件属性

    ActivePage

    用来显示当前页面。

    示例:多页面显示

    procedure TForm1.FormCreate(Sender: TObject);
    var
      i:Integer;
    begin
      for i:= 0 to PageControl1.PageCount-1 do
      begin
        ComboBox1.Items.Add(PageControl1.Pages[i].Caption);
      end;
      ComboBox1.ItemIndex:=0;
    
    end;
    
    procedure TForm1.ComboBox1Change(Sender: TObject);
    begin
      PageControl1.ActivePage:=PageControl1.Pages[comboBox1.itemindex];
    end;

    ActivePageIndex

      获取当前页面的索引,从0到PageCount-1范围之内,

    示例:通过按钮实现多页面切换

    procedure TForm1.Button2Click(Sender: TObject);
    begin
      if PageControl1.ActivePageIndex<PageControl1.PageCount-1 then
        PageControl1.ActivePageIndex:= PageControl1.ActivePageIndex+1;
    end;
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      if PageControl1.ActivePageIndex>0 then
        PageControl1.ActivePageIndex:= PageControl1.ActivePageIndex-1;
    end;
    

      pageCount

      确定page的页数

    TpageCountrol组件的方法

      FindNextPage

    示例:查找页面相关位置。

    procedure TForm1.PageControl1Change(Sender: TObject);
    var
      prevCaption,NextCaption:ShortString;
    begin
      with(Sender as TPageControl)do
      begin
        prevCaption:= FindNextPage(ActivePage,True,False).Caption;
        NextCaption:=findnextpage(ActivePage,False,False).Caption;
      end;
      ShowMessage('下一页是:'+prevcaption+' 前一页是:'+nextcaption+'');
    
    end;
    
    end.

      SelectNexPage

      如果GoForward参赛为true,则选择ActivePage属性指定的后一页,否则指定前一页

  • 相关阅读:
    模块二
    lambda map() filter() zip()练习
    装饰器
    函数模块回顾
    连接不同数据OleDb(不完整)
    连接不同的数据库
    连接数据库ORACLE(不完整)
    多数据之间的连接操作ODBC(不完整)
    ora0131
    ORACLE linux 下 sqlplus命令
  • 原文地址:https://www.cnblogs.com/delphi2014/p/4021001.html
Copyright © 2020-2023  润新知