[DevExpress]设置TreeListNode的背景色

关键代码:

        /// <summary>

        /// 设置节点背景色

        /// 在NodeCellStyle事件中使用

        /// </summary>

        /// <param name="tree">TreeList</param>

        /// <param name="e">GetCustomNodeCellStyleEventArgs</param>

        /// <param name="builderBackColorHandler">委托</param>

        public static void CustomNodeBackColor(this TreeList tree, GetCustomNodeCellStyleEventArgs e, Func<TreeListNode, Color> builderBackColorHandler)

        {

            TreeListNode _node = e.Node;

            e.Appearance.BackColor = builderBackColorHandler(_node);

        }

代码使用:

image

代码效果:

image

你可能感兴趣的:(DevExpress)