delphi cxDBTreeList:最简单的节点图标添加方法


本文整理自网络,侵删。

 
先在窗体上放ImageList关联到cxDBTreeList,在cxDBTreeList的GetNodeImageIndex事件中写如下:
procedure cxDBTreeList1GetNodeImageIndex(Sender:
TcxCustomTreeList; ANode: TcxTreeListNode; AIndexType:
TcxTreeListImageIndexType; var AIndex: TImageIndex);

var
i :Integer;
begin
//给树结点加上图标
for i := 0 to ANode.ValueCount do
begin
if ANode.Level = 0 then
begin
ANode.ImageIndex := 0;
end
else
if ANode.Level = 1 then
begin
ANode.ImageIndex := 2;
end
else
if ANode.Level = 2 then
begin
ANode.ImageIndex := 1;
end;
end;
end;
////=====================
 cxDBTreeList1.fullexpand;  //cxdbtreelist1自动展开节点。
 cxdbtreelist1自动折叠 :    cxDBTreeList1.FullCollapse;
 
//=====================
procedure Tfrmjiankongxinxi.cxDBTreeList1DblClick(Sender: TObject);
var i,sn:Integer;
begin
for i:=0 to cxDBTreeList1.SelectionCount-1 do
    begin
          //ShowMessage(cxDBTreeList1.Selections[i].Values[i]);

          if cxDBTreeList1.FocusedNode.Level=1 then   //判断是不是子节点,1是子节点,0是父节点
           ShowMessage(cxDBTreeList1.Selections[i].Values[i])  //取节点名
          else
          end;


end;

https://www.cnblogs.com/windson/p/12505100.html

相关阅读 >>

Delphi 取16进制字符的10进制的integer值

Delphi setformfullscreen()窗体全屏显示

Delphi 监视剪贴板内容

Delphi判断文件是否正在被使用

Delphi 删除任意文件的任意位置的任意数量的字符

Delphi 关于禁止程序重复启动的另一种需要与实现

Delphi 最简单的文件大小bytes转mb

Delphi 操作“任务栏”

Delphi 替换其他程序里面的函数为自己的函数

Delphi 批量多个字符串合并一个txt文件

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



打赏

取消

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

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

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

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

评论

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