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

# TCustomImageList.Replace

Replaces an image at the specified position with the given bitmap.

## Declaration

Source position: imglist.pp line 387

`public procedure TCustomImageList.Replace(`
`AIndex: Integer;`
`AImage: TCustomBitmap;`
`AMask: TCustomBitmap;`
`const AllResolutions: Boolean = True`
`);`

## Arguments

`AIndex` |  | Ordinal position for the image replace in the method.
`AImage` |  | The bitmap image stored in the method.
`AMask` |  | The bitmap which defines the transparent parts of the image.

## Description

Replace is a procedure used to replace an image stored at the position specified in AIndex.

AImage is a TCustomBitmap type that contains the image stored in the method.

AMask is a TCustomBitmap type that contains the image mask which defines the transparent areas in the image. When AMask is omitted, the image is drawn opaque.

AllResolutions indicates if the image at the specified position is replaced in all resolutions for the image list. When AllResolutions is False, the only resolution updated is the one which uses the width in AImage. When AllResolutions is True, the Resolutions enumerator is used to update each of the TCustomImageListResolution instances in the image list.

The ScaleImage method is called to resize the image and its mask to the width required for an image resolution. The InternalReplace method in the image resolution is called to update the scaled 32-bit raw image data stored at the position in AIndex.

## See also

TCustomImageList.FindResolution |  | Finds the image resolution which uses the specified image width.
TCustomImageList.ScaleImage |  | Scales an image and its optional mask to the specified target size.
TCustomImageList.Resolutions |  | Provides access to the image resolutions (or sizes) used in the image lists.
TCustomImageListResolutions |  | Provides multiple image resolutions in TCustomImageList.