tags:

views:

597

answers:

3

Hi geeks,

I'm having about 200 icons ,which I wanted to display in a treeview on Runtime. Can anyone suggest me the best way to do this.

Do i need to store "relative path" of each icon in "app.config" and load?? or can I compile all the icons to a dll and extract from there...

or any other best suited idea..?

Thanks in advance.

+1  A: 

You should add the icons to the resources of your project, and then it becomes available in the class Properties.Resources.

So you dont have to store any paths.

Only drawback is that you need to compile again if you want to change the icons.

Henri
+1  A: 

Best option: embedded resources in the assembly.

But it does mean changing the icons will require a recompile (the selection of which icons are used could be configurable).

Richard
A: 

Another option would be to add an ImageList to your Form in Design-Mode and the Click 'Choose images' from the Properties Menu. In this dialog you can simply select all your icons and they will be added to your ImageList.

At your code you can access these icons by

imageList.Images[int index]
imageList.Images[string key]
Oliver