本文整理自网络,侵删。
先在窗体上放ImageList关联到cxDBTreeList,在cxDBTreeList的GetNodeImageIndex事件中写如下:procedure cxDBTreeList1GetNodeImageIndex(Sender:TcxCustomTreeList; ANode: TcxTreeListNode; AIndexType:TcxTreeListImageIndexType; var AIndex: TImageIndex);
vari :Integer;begin//给树结点加上图标for i := 0 to ANode.ValueCount dobeginif ANode.Level = 0 thenbeginANode.ImageIndex := 0;endelseif ANode.Level = 1 thenbeginANode.ImageIndex := 2;endelseif ANode.Level = 2 thenbeginANode.ImageIndex := 1;end;end;end;////===================== cxDBTreeList1.fullexpand; //cxdbtreelist1自动展开节点。 cxdbtreelist1自动折叠 : cxDBTreeList1.FullCollapse; //=====================procedure Tfrmjiankongxinxi.cxDBTreeList1DblClick(Sender: TObject);var i,sn:Integer;beginfor 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 setformfullscreen()窗体全屏显示
更多相关阅读请进入《Delphi》频道 >>