TreeList的使用
https://documentation.devexpress.com/#WindowsForms/CustomDocument2434
添加列
TreeListColumn column = treeList1.Columns.Add();
column.Caption = @"建筑列表";
column.VisibleIndex = ;
添加节点
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.
下面的代码,演示了添加多个列
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的ColumnsImageList,SelectImageList,StateImageList为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.

控制节点的高度
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的使用的更多相关文章
- mobiscroll之treelist使用
前言 进行前端开发工作也有一段时间了,一直以来都是渣渣,以前开通博客写过一段时间但是没坚持下来,现在想有时候还是得写写什么吧,自己遇到的新东西写写归纳总结一下总归是好的,并且能够与更多人交流分享,相互 ...
- devexpress treelist 过滤
FilterMode.Smart 问题:dev 的treelist加过滤条件后,如果根节点不符合条件,则不显示数据 处理方法:把filterMode设置为smart即可. 备忘.
- dev TreeList拖拽
一.说明 使用dev控件,TreeList1向TreeList2拖拽 二.属性 //允许拖拽 treeList1.AllowDrop = true; tre ...
- 关于 DevExpress.XtraTreeList.TreeList 树形控件 的操作
作为一个C#程序员,在写程序时一直以来都使用的微软那一套控件,用起来特别爽,可是最近公司的一个项目用到了DevExpress框架,不用不知道,一用吓一跳,不得不承认这个框架确实很强大,效果也很炫,但是 ...
- DevExpress TreeList 全选和反选 z
/// <summary> /// 全选树 /// </summary> /// <param name="tree">树控件</para ...
- DEV winform treelist设置背景图像
treelist是一个复杂的控件,包括选中行,奇偶行等均可以单独设置显示效果,空白区域上背景图像的代码如下: private void treeList1_CustomDrawEmptyArea(ob ...
- Devexpress TreeList控件绑定显示父子节点对像
今天一位同事咨询Devexpress TreeList控件绑定自动显示父子节点对像,但结果是不会显示带父子节点关系,而是将所有的节点作为父节点显示出来了,对像类的代码如下 public class I ...
- Winform TreeList递归绑定树节点
/// <summary> /// 绑定树目录 /// </summary> /// <param name="parentId">父ID< ...
- DEV控件,PopupContainerEdit,PopupContainerControl,TreeList,弹出控制问题
功能描述 PopupContainerEdit的PopupControl设置为PopupContainerControl, PopupContainerControl的里面放一个TreeList, T ...
- 如何让DevExpress TreeList的每个结点高亮显示?
概述:如何让DevExpress TreeList的每个节点高亮显示? 如何让DXperience TreeList的每个节点高亮显示? 效果如下: private void treeList1_Cu ...
随机推荐
- 【linux】自定义配置debian+openbox
openbox确实是好东西阿,小巧,不开iceweasel时内存总使用量不到200M,功能又强大,不过限于我是菜鸟,openbox再强大也有限...debian装openbox是及其简单的,不过为了使 ...
- java 文件及流读取
在Java语言的IO编程中,读取文件是分两个步骤:1.将文件中的数据转换为流,2.读取流内部的数据.其中第一个步骤由系统完成,只需要创建对应的流对象即可,对象创建完成以后步骤1就完成了,第二个步骤使用 ...
- spring的定时任务
maven中引入quartz的jar包依赖 单纯针对时间的设置规则org.springframework.scheduling.quartz.CronTriggerBean允许你更精确地控制任务的运行 ...
- Android扫描文件
扫描文件及文件夹 package com.bwie.demo; import java.io.File; import java.io.FileFilter; import java.util.Arr ...
- centos 7 systemctl
Linux Systemctl是一个系统管理守护进程.工具和库的集合,用于取代System V.service和chkconfig命令,初始进程主要负责控制systemd系统和服务管理器.通过Syst ...
- zabbix如何实现微信报警 转载
现实生产环境中,我们通常使用邮件和短信接受zabbix报警信息,但是邮件经常被工作人员搁置在角落中甚至被设置为垃圾邮件被过滤掉.公司的短信接口又太贵,复杂环境中使用短息报警会使运维成本增加很多.微信提 ...
- 【JQGRID DOCUMENTATION】.学习笔记.5.Form Editing
JqGrid支持为view ,add, edit,delete, search创建一个on the fly的form.这使得Modal Boxes和行内编辑能够在程序用结合.毕竟,行内编辑只能用在已经 ...
- HDU 5898:odd-even number(数位DP)
http://acm.hdu.edu.cn/showproblem.php?pid=5898 题意:给出一个区间[l, r],问其中数位中连续的奇数长度为偶数并且连续的偶数长度为奇数的个数.(1< ...
- 教你ECSHOP去版权与标志(新增272版)
前台部分: 1:去掉头部TITLE部分的ECSHOP演示站 Powered by ecshop 前者在后台商店设置 - 商店标题修改 后者打开includes/lib_main.php $page_t ...
- 各种drawable
BitmapDrawable 可以把小图片平铺布满布局来设置背景. PictureDrawable 记录绘制过程 ClipDrawable 裁剪 进度条 InsetDrawabl ...