Delphi 2009 之 TCategoryPanelGroup[1]: ChevronAlignment 等


本文整理自网络,侵删。

 
制作过程:
先添加一个 TCategoryPanelGroup, 再从其右键菜单 -> New Panel, 反复添加三个 TCategoryPanel.

本例测试了:
TCategoryPanelGroup 的 ChevronAlignment 属性、CollapseAll 和 ExpandAll 方法;
还有 TCategoryPanel 的 Collapsed 属性.

本例效果图:

代码文件:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    CategoryPanelGroup1: TCategoryPanelGroup;
    CategoryPanel1: TCategoryPanel;
    CategoryPanel2: TCategoryPanel;
    CategoryPanel3: TCategoryPanel;
    RadioGroup1: TRadioGroup;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    procedure FormCreate(Sender: TObject);
    procedure RadioGroup1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses TypInfo;

const
  BoolArr: array[Boolean] of string = ('关闭 CPanel1','展开 CPanel1');

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
begin
  CategoryPanel1.Height := ClientHeight div 2;
  CategoryPanel2.Height := CategoryPanel1.Height;
  CategoryPanel3.Height := CategoryPanel1.Height;

  CategoryPanel1.Caption := 'CPanel1';
  CategoryPanel2.Caption := 'CPanel2';
  CategoryPanel3.Caption := 'CPanel3';

  Button1.Tag := 1;
  Button2.Tag := 2;
  Button3.Tag := 3;

  Button2.OnClick := Button1.OnClick;
  Button3.OnClick := Button1.OnClick;

  Button1.Caption := '全部关闭';
  Button2.Caption := '全部展开';
  Button2.Click;

  RadioGroup1.Caption := 'ChevronAlignment';
  for i := 0 to 2 do
    RadioGroup1.Items.Add(GetEnumName(TypeInfo(TAlignment), i));
  RadioGroup1.ItemIndex := 0;
end;

procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
  CategoryPanelGroup1.ChevronAlignment := TAlignment(RadioGroup1.ItemIndex);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  case TButton(Sender).Tag of
    1: CategoryPanelGroup1.CollapseAll;
    2: CategoryPanelGroup1.ExpandAll;
    3: CategoryPanel1.Collapsed := not CategoryPanel1.Collapsed;
  end;
  Button3.Caption := BoolArr[CategoryPanel1.Collapsed];
end;

end.

相关阅读 >>

Delphi ipnumberipv4

Delphi xe10 fdmemtable 数据保存本地和从本地加载

Delphi tgpimage 把图像转存为其他格式

Delphi post数据到网页

Delphi 去掉文件只读属性

Delphi system.fillchar - 填充字节

Delphi 附加数据读取

Delphi 的 tstringbuilder 可以完美实现jave ,c#的tstringbuilder功能

Delphi firedac与ado读写数据的性能测试

Delphi下对dbf文件进行物理删除

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



打赏

取消

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

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

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

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

评论

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