码迷,mamicode.com
首页 > Windows程序 > 详细

Delphi 之 TPageControl组件

时间:2014-10-12 22:08:48      阅读:332      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   ar   for   sp   div   

TPageControl组件属性

ActivePage

用来显示当前页面。

示例:多页面显示

bubuko.com,布布扣

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范围之内,

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

bubuko.com,布布扣

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

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

bubuko.com,布布扣

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属性指定的后一页,否则指定前一页

Delphi 之 TPageControl组件

标签:style   blog   http   color   io   ar   for   sp   div   

原文地址:http://www.cnblogs.com/delphi2014/p/4021001.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!