ITXP365(智码IT网)

分享电脑知识,传播IT技巧

致敬爱学习的您,祝您访问愉快!

DevExpress控件之TcxTreeList控件常用


发布:智码IT网   阅读:
//【添加item】
TreeList1.BeginUpdate();
TreeList1.Clear;  //清空

var tlItem := TreeList1.AddChild(nil,oPerson);
tlItem.Texts[0] := oPerson.RID;
tlItem.Texts[1] := oPerson.PerID;

TreeList1.EndUpdate();

//【显示复选框】
tlRyList.Root.CheckGroupType := ncgCheckGroup;  ///显示根复选框
tlRyList.OptionsView.CheckGroups := True;       //显示子复选框
//显示所有item的复选框
for var i := 0 to tlRyList.AbsoluteCount - 1 do
  tlRyList.AbsoluteItems[i].CheckGroupType := ncgCheckGroup;  //多选或单选

//【常用】

//默认行号
TreeList1.DefaultRowHeight := 30;

//可否编辑
TreeList1.OptionsData.Editing = False

//FocusedNode的层级  从0开始,rootNode的Level为0
var iLevel := TreeList1.FocusedNode.Level; 

//全部节点展开
TreeList1.FullExpand(); 

//全部节点折叠
TreeList1.FullCollapse(); 

//【遍历items】
procedure TreeList_SelAll(ATreeList: TcxTreeList);
begin
  for var i := 0 to ATreeList.AbsoluteCount - 1 do
  begin
    ATreeList.AbsoluteItems[i].Checked := True;
  end;
end;




上一篇:没有了
下一篇:没有了

© 2001-智码IT网 www.itxp365.com版权所有

蜀ICP备2021001527号