[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'ImgList' (#lcl)

# TCustomImageList.AddIcon

Adds an icon to the image list.

## Declaration

Source position: imglist.pp line 348

`public function TCustomImageList.AddIcon(`
`Image: TCustomIcon`
`):Integer;`

## Arguments

`Image` |  | The Icon to be added.

## Function result

The index of the added icon, -1 if unsuccessful.

## Description

AddIcon is used to add the TIcon instance in the Image parameter to the image list. AddIcon calls InsertIcon to store the Image at the ordinal position represented by the Count property. The return value contains the index of the newly added icon, or -1 if the icon could not be added to the list.

Use the Add or AddMasked method to store a TCustomBitmap descendant in the image list.

## See also

TCustomImageList.InsertIcon |  | Inserts an Icon into each of the resolutions for the image list.
TCustomImageList.Count |  | Number of images stored in the default resolution for the image list.