You can use the Add method of the ListImages Collection
to add images to the ImageList at runtime. The syntax
for Add is as follows:
Here ImageList1 is the name of the ImageList control
on your form. Index and Key are optional parameters. If Index is specified, it
will be the location at which the image is loaded into the
ListImages Collection. If Index is omitted, the new image will be inserted
at the end of the collection. Key is a string value that you can use to refer
to an image in the list without knowing its index value. For example if an image
were added as follows:
"folder icon", LoadPicture("folder.ico"))
you might not know the index
value of the new image, but you could still
refer to it in this way:
Picture1.Picture = ImageList1.ListImages("folder
Using the ListImages key makes your code more readable
than if you refer to images with the Index property.
You can remove a ListImage from the
ListImages Collection with the Remove method.
You can use Remove either by specifying the index of the image:
or by providing the image's
ImageList1.ListImages.Remove "key value"
Related topics on ImageList Control