• Devexpress 设置TreeList图标


    几年不用Devexpress,居然TreeList设置图标都忘记怎么弄了,记录下

    1、窗口上拖动一个TreeList和一个ImageCollection

    2、设置ImageCollection图像

     3、设置

     4、代码如下

    public Form1()
    {
        InitializeComponent();
        //TreeListNode treeNode = new TreeListNode();
        //treeNode.ImageIndex = 0;
        //treeNode.SetValue("ID", "111");
        //treeList1.Nodes.Add(treeNode);
    
        List<DataSingle> dataSingles = new List<DataSingle>();
        DataSingle dataSingle = new DataSingle();
        dataSingle.ID = 1111;
        dataSingle.TEXT = "22222";
        dataSingle.ImgIndex = 0;
        dataSingles.Add(dataSingle);
        treeList1.DataSource = dataSingles;
    
    }
    public class DataSingle
    {
        public int ID { get; set; }
        public string TEXT { get; set; }
        public int ImgIndex { get; set; }
    }
    
    
    private void treeList1_CustomDrawNodeImages(object sender, DevExpress.XtraTreeList.CustomDrawNodeImagesEventArgs e)
    {
        if(e.Node.GetValue("ImgIndex")!=null)
        e.SelectImageIndex = int.Parse(e.Node.GetValue("ImgIndex").ToString());
    }
    

      

    5、结果

      

  • 相关阅读:
    jeesite导入导出
    jeesite下载
    百度echart
    js获取日期
    清除svn
    父子窗口
    JS高级程序设计之高级技巧
    JS中离线应用与客户端存储
    JS最佳实践
    JSON之JS高级程序设计笔记
  • 原文地址:https://www.cnblogs.com/zhaogaojian/p/13910800.html
Copyright © 2020-2023  润新知