Skip to main content

TcxCustomImageList.Add(TGraphic,TBitmap) Method

Appends the specified image and its transparency mask bitmap to the image list.

Declaration

function Add(AImage: TGraphic; AMask: TBitmap): Integer; overload;

Parameters

Name Type Description
AImage TGraphic

A source image container.

AMask TBitmap

A transparency mask bitmap.

Returns

Type Description
Integer

The index of the image passed as the AImage parameter if the add operation is successful; otherwise, -1.

Remarks

The Add function divides the loaded image passed as the AImage parameter into multiple images or truncates the image to match the list’s dimensions. The number of new images depends on how much the source image width exceeds the Width property value. For instance, if the loaded image is 260 by 16 pixels and the Width property is set to 16, the Add function divides it into 16 images that are 16 by 16 pixels, and appends them consecutively to the image list. The rightmost part of the source image (which is 4 by 16 pixels) is omitted. This feature is particularly useful if you store multiple icons within a single image file.

This function allows you to pass a transparency mask bitmap for the appended image as the AMask parameter. To omit the mask, pass nil (in Delphi) or nullptr (in C++Builder).

Note

The transparency mask bitmap is ignored if the Masked property is set to False.

See Also