手机
当前位置:查字典教程网 >编程开发 >C#教程 >DevExpress设置TreeList图片节点背景色的方法
DevExpress设置TreeList图片节点背景色的方法
摘要:本文实例展示了DevExpress设置TreeList图片节点背景色的方法,在项目开发中有一定的应用价值,具体方法如下所示:主要功能代码如下...

本文实例展示了DevExpress设置TreeList图片节点背景色的方法,在项目开发中有一定的应用价值,具体方法如下所示:

主要功能代码如下:

/// <summary> /// 设置图片节点的背景色 /// 说明:在CustomDrawNodeImages事件中使用 /// </summary> /// <param name="tree">TreeList</param> /// <param name="e">CustomDrawNodeImagesEventArgs</param> /// <param name="builderBackColorHandler">委托</param> public static void CustomImageNodeBackColor(this TreeList tree, CustomDrawNodeImagesEventArgs e, Func<TreeListNode, Color> builderBackColorHandler) { TreeListNode _node = e.Node; Color _backColor = builderBackColorHandler(_node); e.Graphics.FillRectangle(new SolidBrush(_backColor), e.Bounds); }

代码使用方法如下:

private void tlLHData_CustomDrawNodeImages(object sender, CustomDrawNodeImagesEventArgs e) { try { tlLHData.CustomImageNodeBackColor(e, node => { string _cabId = node.GetKeyID(); CCabInfo _cabInfo = LHDBHelper.GetCabInfo(_cabId); if (_cabInfo != null) { return _cabInfo.CtuOnlineStatus == 1 ? Color.White : Color.LightGray; } return Color.White; }); } catch (Exception) { } }

代码运行效果如下图所示:

DevExpress设置TreeList图片节点背景色的方法1

【DevExpress设置TreeList图片节点背景色的方法】相关文章:

使用DateTime的ParseExact方法实现特殊日期时间的方法详解

C#计算代码执行时间的方法

PowerShell 定时执行.Net(C#)程序的方法

C#给picturebox控件加图片选中状态的2个方法

C# 将字节流转换为图片的实例方法

c#在控制台输出彩色文字的方法

C#使用DllImport调用非托管的代码的方法

C#访问应用程序配置文件的方法

c#生成缩略图的实现方法

C# TrieTree介绍及实现方法

精品推荐
分类导航