Notifications
Clear all

[Closed] dotNet TreeView, imagelist

 JHN

Hi all,

I have a treeview with a imagelist of shaderballs, now I want to be able to draw on the imagelist images. But I have not found a way to extract bitmaps from an imagelist, is it possible?

Thanks,
-Johan

6 Replies

a few seconds on MSDN and the solution appears to be:

ImageList.Images.Item[index]

I have only invested a few seconds on research and not tested this but it seems logical to me

Nope, the imageindex defaults to -1 if not set to anything but doesn’t work sadly… I tried making an image 1×16 pixels big but it still puts an imagebox 16×16 there.

you should be able not show an image using index -1 but the item’s text will be shifted right anyway on a size of image list.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

i was wrong. the setting of -1 index doesn’t set empty image. so you have to make empty bitmap and add it to the list.

In C# I think you have to explicitly assign the image, otherwise it doesn’t have one… But I’m not 100% sure on that. I manually assigned the index as I added my nodes, so maybe they did have an image, but I didn’t see it.

I decided that the easiest solution to this was the blatantly obvious and simpliest one… make a folder icon and use that rather than trying to remove the image…