c# - How to set an icon for each object in TreeListView -
c# - How to set an icon for each object in TreeListView -
i have icons should displayed in first column next name of rowobject. different pictures related different type of obects. part of code creates columns objects need.
this.descriptiontview = new brightideassoftware.treelistview(); this.descriptiontview.canexpandgetter = x => { if ( ( x itreeviewitem ).items != null ) { homecoming ( x itreeviewitem ).items.length > 0; } else { homecoming false; } }; this.descriptiontview.childrengetter = x => ( x itreeviewitem ).items; var column1 = new brightideassoftware.olvcolumn( "", "part0" ); column1.aspectgetter = x => ( x itreeviewitem ).part0; column1.iseditable = true; var column2 = new brightideassoftware.olvcolumn( "", "part1" ); column2.aspectgetter = x => ( x itreeviewitem ).part1; column1.iseditable = true; column2.iseditable = true; this.descriptiontview.columns.add( column1 ); this.descriptiontview.columns.add( column2 ); private list<itreeviewitem> itemslist; descriptiontview.roots = itemslist;
you have create , assign imagelist containing images want utilize example
descriptiontview.smallimagelist = imagelist1;
then can implement imagegetter desired column
column1.imagegetter = delegate(object rowobject) { // decide depending on rowobject image homecoming homecoming 0; };
you can homecoming name of image in list, instead of index.
you may have set
descriptiontview.ownerdraw = true;
an alternative image straight row object using imageaspectname
column1.imageaspectname = "myimage"; // assuming object has property `public bitmap myimage;`
c# objectlistview treelistview
Comments
Post a Comment