Type | Description | |||
Icon as Variant |
A Variant expression that specifies the icon to add or insert, as one of the
following options:
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:
By default, if the Index parameter is not specified or is missing, a value of -1 is used. |
Return | Description | |||
Long | A long expression that indicates the index of the icon in the images collection. |
Use the ReplaceIcon property to add, remove or replace an icon in the control's images collection. Also, the ReplaceIcon property can clear the images collection. Use the Images method to attach a image list to the menu control.
The following sample shows how to add a new icon to control's images list:
i = ExMenu1.ReplaceIcon( LoadPicture("d:\icons\help.ico").Handle), where i is the index to insert the icon
The following sample shows how to replace an icon into control's images list::
i = ExMenu1.ReplaceIcon( LoadPicture("d:\icons\help.ico").Handle, 0), in this case the i is zero, because the first icon was replaced.
The following sample shows how to remove an icon from control's images list:
ExMenu1.ReplaceIcon 0, i, in this case the i must be the index of the icon that follows to be removed
The following sample shows how to clear the control's icons collection:
ExMenu1.ReplaceIcon 0, -1