DevTreeListView.SetImageIndex 设置TreeList显示的图标
DevTreeListView.SetImageIndex 设置TreeList显示的图标
扫一扫加微信
C# Code:
/// <summary>
/// 设置TreeList显示的图标
/// </summary>
/// <param name="tl">TreeList组件</param>
/// <param name="node">当前结点,从根结构递归时此值必须=null</param>
/// <param name="nodeIndex">根结点图标(无子结点)</param>
/// <param name="parentIndex">有子结点的图标</param>
public static void SetImageIndex(TreeList tl, TreeListNode node, int nodeIndex, int parentIndex)
{
if (node == null)
{
foreach (TreeListNode N in tl.Nodes)
SetImageIndex(tl, N, nodeIndex, parentIndex);
}
else
{
if (node.HasChildren || node.ParentNode == null)
{
//node.SelectImageIndex = parentIndex;
node.StateImageIndex = parentIndex;
node.ImageIndex = parentIndex;
}
else
{
//node.SelectImageIndex = nodeIndex;
node.StateImageIndex = nodeIndex;
node.ImageIndex = nodeIndex;
}
foreach (TreeListNode N in node.Nodes)
{
SetImageIndex(tl, N, nodeIndex, parentIndex);
}
}
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
/// <summary>
/// 设置TreeList显示的图标
/// </summary>
/// <param name="tl">TreeList组件</param>
/// <param name="node">当前结点,从根结构递归时此值必须=null</param>
/// <param name="nodeIndex">根结点图标(无子结点)</param>
/// <param name="parentIndex">有子结点的图标</param>
public static void SetImageIndex(TreeList tl, TreeListNode node, int nodeIndex, int parentIndex)
{
if (node == null)
{
foreach (TreeListNode N in tl.Nodes)
SetImageIndex(tl, N, nodeIndex, parentIndex);
}
else
{
if (node.HasChildren || node.ParentNode == null)
{
//node.SelectImageIndex = parentIndex;
node.StateImageIndex = parentIndex;
node.ImageIndex = parentIndex;
}
else
{
//node.SelectImageIndex = nodeIndex;
node.StateImageIndex = nodeIndex;
node.ImageIndex = nodeIndex;
}
foreach (TreeListNode N in node.Nodes)
{
SetImageIndex(tl, N, nodeIndex, parentIndex);
}
}
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
扫一扫加微信
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网