method ToolTip.ReplaceIcon ([Icon as Variant], [Index as Variant])
Adds a new icon, replaces an icon or clears the control's image list.

TypeDescription
Icon as Variant A Variant expression that specifies the icon to add or insert, as one of the following options:
  • a long expression that specifies the handle of the icon (HICON)
  • a string expression that indicates the path to the picture file
  • a string expression that defines the picture's content encoded as BASE64 strings using the eXImages tool
  • a Picture reference, which is an object that holds image data. It is often used in controls like PictureBox, Image, or in custom controls (e.g., IPicture, IPictureDisp)

If the Icon parameter is 0, it specifies that the icon at the given Index is removed. Furthermore, setting the Index parameter to -1 removes all icons.

By default, if the Icon parameter is not specified or is missing, a value of 0 is used.

Index as Variant A long expression that defines the index of the icon to insert or remove, as follows:
  • A zero or positive value specifies the index of the icon to insert (when Icon is non-zero) or to remove (when the Icon parameter is zero)
  • A negative value clears all icons when the Icon parameter is zero

By default, if the Index parameter is not specified or is missing, a value of -1 is used.

ReturnDescription
LongA long expression that indicates the index of the icon in the images collection
Use the ReplaceIcon method to add, remove or clear icons in the control's images collection. Use the Images method to assign a list of icons to the tooltip. The ImageSize property defines the size (width/height) of the icons within the control's Images collection. The HTMLPicture property handles a collection of custom size picture being displayed in the HTML captions, using the <img> built-in HTML elements. Also, the ReplaceIcon property can clear the images collection.

The following VB sample adds a new icon to control's images list:

 i = ExToolTip1.ReplaceIcon( LoadPicture("d:\icons\help.ico").Handle), i specifies the index where the icon is added

The following VB sample replaces an icon into control's images list::

 i = ExToolTip1.ReplaceIcon( LoadPicture("d:\icons\help.ico").Handle, 0), i is zero, so the first icon is replaced.  

The following VB sample removes an icon from control's images list:

 ExToolTip1.ReplaceIcon 0,  i, where i specifies the index of icon removed.

The following VB clears the control's icons collection:

 ExToolTip1.ReplaceIcon 0,  -1