1:在事件InitializeComponent中加载获取图标并加载进入ImageCollection(Name:icFolders)
this.icFolders.ImageStream = ((DevExpress.Utils.ImageCollectionStreamer)(resources.GetObject("icFolders.ImageStream"))); this.icFolders.InsertGalleryImage("apply_16x16.png", "images/actions/apply_16x16.png", DevExpress.Images.ImageResourceCache.Default.GetImage("images/actions/apply_16x16.png"), 0); this.icFolders.Images.SetKeyName(0, "apply"); this.icFolders.InsertGalleryImage("fill_16x16.png", "images/actions/fill_16x16.png", DevExpress.Images.ImageResourceCache.Default.GetImage("images/actions/fill_16x16.png"), 1); this.icFolders.Images.SetKeyName(1, "fill");
2:TreeList节点动态加载图标
遍历节点设置节点属性
//TreeListNode tln tln.ImageIndex = icFolders.Images.IndexOf(icFolders.Images["fill"]); tln.SelectImageIndex = icFolders.Images.IndexOf(icFolders.Images["fill"]);