Visual Basic: Windows Controls

Visual Studio 6.0

ListImage Object, ListImages Collection

See Also    Example    Properties    Methods    Events

  • A ListImage object is a bitmap of any size that can be used in other controls.

  • A ListImages collection is a collection of ListImage objects.




The syntax lines above refer to the collection and to individual elements in the collection, respectively, according to standard collection syntax.

The ListImage Object, ListImages Collection syntaxes have these parts:

Part Description
imagelist Required. An object expression that evaluates to an object in the Applies To list.
index An integer or string that uniquely identifies the object in the collection. The integer is the value of the Index property; the string is the value of the Key property.


The ListImages collection is a 1-based collection.

You can add and remove a ListImage at design time using the General tab of the ImageList Control Properties page, or at run time using the Add method for ListImage objects.

Each item in the collection can be accessed by its index or unique key. For example, to get a reference to the third ListImage object in a collection, use the following syntax:

Dim imgX As ListImage
   ' Reference by index number.
Set imgX = ImageList.ListImages(3) 
   ' Or reference by unique key.
Set imgX = ImageList1.ListImages("third") ' Assuming Key is "third."
   ' Or use Item method.
Set imgX = ImageList1.ListImages.Item(3)

Each ListImage object has a corresponding mask that is generated automatically using the MaskColor property. This mask is not used directly, but is applied to the original bitmap in graphical operations such as the Overlay and Draw methods.