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.

相关阅读 >>

Delphi 获取电脑进程网络连接ip端口

Delphi 拖动文件到exe 打开 获取getcommandline命令行

Delphi 删除cookies及上网记录

Delphi waitforsingleobject 响应窗体

Delphi文本数据导入数据库的方法

Delphi 绘制精美的签名图片

Delphi在目录中搜索文件

Delphi获取当前计算机所有盘符

Delphi 提升进程令牌

Delphi实现阿里云印刷文字识别_身份证识别

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...