https://documentation.devexpress.com/#WindowsForms/CustomDocument2434

添加列

   TreeListColumn column = treeList1.Columns.Add();
column.Caption = @"建筑列表";
column.VisibleIndex = ;

添加节点

https://documentation.devexpress.com/#WindowsForms/DevExpressXtraTreeListNodesTreeListNodes_Addtopic(5DdNJQ)

treeList1.Nodes.Add(new object[] {item});

This method calls the TreeList.AppendNode(nodeData, ParentNode) method. The ParentNode property's value is passed as the method's second parameter. See the TreeList.AppendNode topic to learn more.

https://documentation.devexpress.com/#WindowsForms/DevExpressXtraTreeListTreeList_AppendNodetopic(qybC6w)

下面的代码,演示了添加多个列

private void Form1_Load(object sender, EventArgs e) {
CreateColumns(treeList1);
CreateNodes(treeList1);
} private void CreateColumns(TreeList tl) {
// Create three columns.
tl.BeginUpdate();
tl.Columns.Add();
tl.Columns[].Caption = "Customer";
tl.Columns[].VisibleIndex = ;
tl.Columns.Add();
tl.Columns[].Caption = "Location";
tl.Columns[].VisibleIndex = ;
tl.Columns.Add();
tl.Columns[].Caption = "Phone";
tl.Columns[].VisibleIndex = ;
tl.EndUpdate();
} private void CreateNodes(TreeList tl) {
tl.BeginUnboundLoad();
// Create a root node .
TreeListNode parentForRootNodes = null;
TreeListNode rootNode = tl.AppendNode(
new object[] { "Alfreds Futterkiste", "Germany, Obere Str. 57", "030-0074321" },
parentForRootNodes);
// Create a child of the rootNode
tl.AppendNode(new object[] { "Suyama, Michael", "Obere Str. 55", "030-0074263" }, rootNode);
// Creating more nodes
// ...
tl.EndUnboundLoad();
}

禁用编辑

禁用TreeList

   treeList1.OptionsBehavior.Editable = false;

禁用单个列

    TreeListColumn column = treeList1.Columns.Add();
column.Caption = @"建筑列表";
column.VisibleIndex = ;
column.OptionsColumn.AllowEdit = false;
column.OptionsColumn.ReadOnly = true;

设置选中行的背景色

TreeList.Appearance.FocusedRow

https://www.devexpress.com/Support/Center/Question/Details/Q419028

To solve the issue, disable the TreeList.OptionsSelection.EnableAppearanceFocusedCelloption.

标题

必须先添加列,才能有标题(标题是列标题,TreeList本身的Caption是不显示的)

添加节点图片

http://www.cnblogs.com/zzh1236/archive/2012/06/29/2570057.html

1.添加一个ImageCollection,控件名为imageCollection1 【多个form共用的话,可以使用SharedImageCollection

按照节点的层级顺序添加图片

2. 设置TreeList的ColumnsImageListSelectImageListStateImageList为imageCollection1

3. 注册TreeList的CustomDrawNodeImages事件

treeList1.CustomDrawNodeImages += TreeList1_CustomDrawNodeImages;
private void TreeList1_CustomDrawNodeImages(object sender, CustomDrawNodeImagesEventArgs e)
{
e.SelectImageIndex = e.Node.Level;
}

NodeImage

概念:https://documentation.devexpress.com/#WindowsForms/CustomDocument1073

Nodes can display two images.

  • Select Image - Typically indicates the node selection (focus) state. However, the same select image can be displayed for a node regardless of the node state. The TreeList provides a mechanism to automatically substitute替代 a select image when a node receives/loses focus.
  • State Image - Typically indicates any state of a node.

If both select and state images are specified, the select image is displayed first.

The table below lists the main properties affecting element appearance.

控制节点的高度

https://documentation.devexpress.com/#WindowsForms/DevExpressXtraTreeListTreeList_CalcNodeHeighttopic

Allows you to assign custom node height.

EventData

The event handler receives an argument of type CalcNodeHeightEventArgs containing data related to this event.

The following CalcNodeHeightEventArgs properties provide information specific to this event.

Node Gets the current Tree List node.
NodeHeight Gets or sets the current node's height in pixels.

Remarks

Write a CalcNodeHeight event handler to assign custom node height for the TreeList control.

The event fires for each visible node each time a node's look & feel is affected.

The parameter transmitted to the event allows you to identify a node whose height is calculated and assign the appropriate custom height.

Note: the CalcNodeHeight event fires only if the TreeListOptionsBehavior.AutoNodeHeight option is disabled.

Use the CalcNodeHeight event if you want to assign different node heights to the TreeList control.

If you want to assign the same height to all nodes, use the RowHeight property instead.

TreeList的使用的更多相关文章

  1. mobiscroll之treelist使用

    前言 进行前端开发工作也有一段时间了,一直以来都是渣渣,以前开通博客写过一段时间但是没坚持下来,现在想有时候还是得写写什么吧,自己遇到的新东西写写归纳总结一下总归是好的,并且能够与更多人交流分享,相互 ...

  2. devexpress treelist 过滤

    FilterMode.Smart 问题:dev 的treelist加过滤条件后,如果根节点不符合条件,则不显示数据 处理方法:把filterMode设置为smart即可. 备忘.

  3. dev TreeList拖拽

    一.说明 使用dev控件,TreeList1向TreeList2拖拽 二.属性 //允许拖拽            treeList1.AllowDrop = true;            tre ...

  4. 关于 DevExpress.XtraTreeList.TreeList 树形控件 的操作

    作为一个C#程序员,在写程序时一直以来都使用的微软那一套控件,用起来特别爽,可是最近公司的一个项目用到了DevExpress框架,不用不知道,一用吓一跳,不得不承认这个框架确实很强大,效果也很炫,但是 ...

  5. DevExpress TreeList 全选和反选 z

    /// <summary> /// 全选树 /// </summary> /// <param name="tree">树控件</para ...

  6. DEV winform treelist设置背景图像

    treelist是一个复杂的控件,包括选中行,奇偶行等均可以单独设置显示效果,空白区域上背景图像的代码如下: private void treeList1_CustomDrawEmptyArea(ob ...

  7. Devexpress TreeList控件绑定显示父子节点对像

    今天一位同事咨询Devexpress TreeList控件绑定自动显示父子节点对像,但结果是不会显示带父子节点关系,而是将所有的节点作为父节点显示出来了,对像类的代码如下 public class I ...

  8. Winform TreeList递归绑定树节点

    /// <summary> /// 绑定树目录 /// </summary> /// <param name="parentId">父ID< ...

  9. DEV控件,PopupContainerEdit,PopupContainerControl,TreeList,弹出控制问题

    功能描述 PopupContainerEdit的PopupControl设置为PopupContainerControl, PopupContainerControl的里面放一个TreeList, T ...

  10. 如何让DevExpress TreeList的每个结点高亮显示?

    概述:如何让DevExpress TreeList的每个节点高亮显示? 如何让DXperience TreeList的每个节点高亮显示? 效果如下: private void treeList1_Cu ...

随机推荐

  1. zw版_Halcon图像交换、数据格式、以及超级简单实用的DIY全内存计算.TXT

    zw版_Halcon图像交换.数据格式.以及超级简单实用的DIY全内存计算.TXT Halcon由于效率和其他原因,内部图像采用了很多自有格式,提高运行速度,但在数据交换方面非常麻烦. 特别是基于co ...

  2. 【rails3教材】博客构建过程2

    2. 使用脚手架快速搭建网页 rails的脚手架可以快速生成应用程序的一些片段,如果你需要为一个资源创建一系列的控制器视图模型,那么脚手架就是你需要的工具 3. 创建资源 对于一个博客程序,你可以以生 ...

  3. 非 动态规划---LIS

    题目:一个序列有N个数:A[1],A[2],…,A[N],求出最长非降子序列的长度.(见动态规划---LIS) /* 题目:一个序列有N个数:A[1],A[2],…,A[N],求出最长非降子序列的长度 ...

  4. AMD机制与cMD的区别和概念简要介绍

    1.http://www.cnblogs.com/dojo-lzz/p/4707725.html 2.http://blog.chinaunix.net/uid-26672038-id-4112229 ...

  5. android 学习随笔十七(服务 )

    1.Service 四大组件之一 运行于后台,没有前台界面的组件,用于运行需要在后台运行的代码 可以理解为没有前台的Activity 定义方式:创建java类继承Service,清单文件中注册该类 p ...

  6. Linux 的 Crontab 命令运用(转)

    cron来源于希腊单词chronos(意为“时间”),是linux系统下一个自动执行指定任务的程序.例如,你想在每晚睡觉期间创建某些文件或文件夹的备份,就可以用cron来自动执行. 服务的启动和停止 ...

  7. Jquery 插件库

    http://www.jq22.com/ 日期:  http://laydate.layui.com/

  8. PHP弱类型安全问题的写法和步骤

    鉴于目前PHP是世界上最好的语言,PHP本身的问题也可以算作是web安全的一个方面.在PHP中的特性就是弱类型,以及内置函数对于传入参数的松散处理.本篇文章主要就是记录我在做攻防平台上面遇到的PHP的 ...

  9. js 字符串比较

    <script type="text/javascript"> function test(){ //1)纯数字之间比较 //alert(1<3);//true ...

  10. PHP 页面编码声明与用header或meta实现PHP页面编码的区别

    php的header来定义一个php页面为utf编码或GBK编码 php页面为utf编码 header("Content-type: text/html; charset=utf-8&quo ...