DevTreeListView.SetImageIndex 设置TreeList显示的图标
作者:C/S框架网|www.cscode.ne  发布日期:2021-06-03 16:34:40
  DevTreeListView.SetImageIndex 设置TreeList显示的图标


贴图图片-treelistlookupedit


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




C/S框架网|原创精神.创造价值.打造精品

扫一扫加微信
C/S框架网作者微信 C/S框架网|原创作品.质量保障.竭诚为您服务

上一篇 下一篇