节点图片:
//ImageList
ImageList list = new ImageList();
list.Images.Add(new Bitmap("C:\\Users\\Thinkpad\\Desktop\\素材\\Home.png"));
list.Images.Add(new Bitmap("C:\\Users\\Thinkpad\\Desktop\\素材\\home (2).png"));
list.Images.Add(new Bitmap("C:\\Users\\Thinkpad\\Desktop\\素材\\star_full.png"));
//设置TreeList属性
this.treeList1.ColumnsImageList = list;
this.treeList1.SelectImageList = list;
this.treeList1.StateImageList = list;
//注册事件
this.treeList1.CustomDrawNodeImages+=new CustomDrawNodeImagesEventHandler(treeList1_CustomDrawNodeImages);
private void treeList1_CustomDrawNodeImages(object sender, CustomDrawNodeImagesEventArgs e)
{
// e.SelectImageIndex为图片在ImageList中的index
e.SelectImageIndex = e.Node.Level;
}
是否显示 [+]/[-] 即展开、合并
//显示 + - 即合并图标
treeList1.LookAndFeel.UseDefaultLookAndFeel = false;
treeList1.LookAndFeel.UseWindowsXPTheme = true;