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

# TCustomImageList.Add

Adds an image to the list using its source data and optional mask.

## Declaration

Source position: imglist.pp line 342

`public function TCustomImageList.Add(`
`Image: TCustomBitmap;`
`Mask: TCustomBitmap`
`):Integer;`

## Arguments

`Image` |  | Bitmap image data added in the method.
`Mask` |  | A bitmap mask which defines the transparent parts of Image.

## Function result

The index of the added image.

## Description

Add is an Integer function used to to add the specified Image and its optional Mask to the image list.

Image is the TCustomBitmap instance with image data added in the method.

Mask is a TCustomBitmap instance which contains a monochrome bitmap which defines the transparent areas for the image. When Mask contains a valid bitmap, it is combined with the source data in Image before it is stored in the image list. When Mask contains Nil, the Image has no defined transparent areas.

The return values contains the ordinal position in the image list for the newly added image.

Add calls the Insert method to store Image and Mask in the image list. The Image and optional Mask are scaled and added to each of the defined Resolutions in the image list. No actions are performed in the method when Image has not been assigned (contains Nil).

Use AddMasked to add a masked image where MaskColor defines the transparent areas in the image.

Use the AddSlice method to store an image from source data in the image list storage format. Use the AddSliced method to store all images from source data in the image list storage format.

## See also

TCustomImageList.AddMasked |  | Adds an image(s) to the list using the MaskColor for transparent pixels.
TCustomImageList.AddSliced |  | Adds images to the image list from image data stored as adjacent columns and rows.
TCustomImageList.AddSlice |  | Adds a portion of an image to each of the resolutions in the image list.
TCustomImageListResolution |  | Implements an image resolution (or size) used in TCustomImageList.