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 使用fastscript调试脚本

Delphi xe5在zip文件中添加某个txt文件并写入文字

Delphi之软件检测更新

Delphi image 等比例缩小

Delphi 两字符串之间添加分隔符

Delphi 读取image组件转换base64编码

Delphi调用javascript解析json

Delphi firedac 的recordcount 相关测试 记录

Delphi simple resource api replacement

Delphi firedac tfddatamove 导出csv

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



打赏

取消

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

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

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

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

评论

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