Treeview Imagelist - Best practices for managing images?

G

Grant Schenck

Hello,

I'm going round and round on how to best handle images for a treeview
control. These are all known at design time so there is no dynamic aspect.

That said, I want to associate the image with my project so I can easily
edit them.

It seems like I need to do this:
- Create one bitmap per image.
- Create an imagelist containing each bitmap file.
- Associate the imagelist with my treeview.

Is that the best way? I have a lot of images and I'll end up with a lot of
BMP files.

In MSVC 6.0, I could put all of the images into a single bitmap and
associate that with the tree control. Is there a similar notion in C#?

Thanks!

Grant Schenck
 
K

Kevin Yu [MSFT]

Hi Grant,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to put all the images for a
TreeView control in a single bmp file as VC6 does. If there is any
misunderstanding, please feel free to let me know.

As far as I know, this is not supported in .NET. We have to load each image
one by one into an ImageList to achieve this. I suggest you put all the
images used by this TreeView in a folder and load.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
K

Kevin Yu [MSFT]

You're welcome, Grant. I'm just sorry for the inconvenience.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top