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 getmem(mystring,1024);//开辟1024个字节freemem(mystring,1024);//释放

Delphi获取两个字符之间的数

Delphi中如何给一个字符串从左边进行补0

Delphi 获取程序自身大小的函数

Delphi xe5 android 开发实现手机打电话和发短信

Delphi winapi: messagebeep - 播放一个系统声音

Delphi savetextfiledialog 用法

Delphi 与 graphics gdi+ 基础学习

Delphi日期函数、日期加减

Delphi 链接获取主站地址

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



打赏

取消

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

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

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

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

评论

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

    暂无评论...