Using an image file in my application

Hi,

I am developing a windows based application. I need to associate images with the nodes that I am adding to a tree.

Currently I am hardcoding the path of the image while adding the image to the node. However because of this, the images are recognised on my machine only.

How can I add the images to the nodes so that they will be accessible on other machines also




Answer this question

Using an image file in my application

  • Yuelin

    Add an ImageList to your form and add the images to it. Next, set the ImageList property of your TreeView to the ImageList you just created. Finally, set the ImageIndex property of the TreeView nodes as they are created/modified/etc to correspond to the desired image in the ImageList.

  • Eaglepigjim

    Hi,

    I am not adding the images from a windows form. There is a separate class library that populates the windows form by adding the nodes to the tree. I need to add the nodes in the class library. I dont think I can take the same approach as the one suggested. Please help.

    Utsav



  • Using an image file in my application