Identify items in an Image List

  • Thread starter Thread starter Brian Mitchell
  • Start date Start date
B

Brian Mitchell

Is it possible to somehow tag the items in an Image List? I have a list that
gets filled at runtime and I have no idea how to identify which images are
loaded? (it loads random images from the hard drive)

Thanks!!
 
Brian

One way to achive this would be to create you own class that inherits from the ImageList control and provides an additional property to store the information you need

Gary
 
The System.Windows.Forms.ImageList is a non-inheritable class.

Is there another way to do it?


Gary Milton said:
Brian,

One way to achive this would be to create you own class that inherits from
the ImageList control and provides an additional property to store the
information you need.
 
Brian

Sorry - I should have checked this before I gave you that suggestion. I have inherited from other controls before but not the ImageList

Without inheritance, another way is to write a wrapper class that creates its own internal instance of the ImageList. You would then need to write duplicate properties and methods as the ImageList contains which simply just propagate information to and from the internal ImageList. You can then create a new Tag property on your own class but you will have to keep an internal collection of objects that map to the items in the ImageList based on the item index of each image you add

Gary
 
Back
Top