Sign in Join
FPDoc Onlineexperiment

TCustomImageList.ReplaceIcon procedure

Member of TCustomImageListpublicIn unit ImgList

Replaces the icon at the specified position in all resolutions for the image list.

Declaration

pascal
procedure ReplaceIcon(AIndex: Integer; AIcon: TCustomIcon)

Arguments

AIndex

Ordinal position for the icon replaced in the method.

AIcon

Icon stored in the method.

Description

ReplaceIcon is a procedure used to replace the icon stored at the position specified in AIndex in all resolutions for the image list.

AIcon is a TCustomIcon type that contains the graphic image stored in the method. No actions are performed in the method when AIcon has not been assigned (contains Nil).

Icons can contain multiple sizes, and must be in ascending size order to ensure they are applied correctly to image resolutions. ReplaceIcon create a temporary TIcon instance that is used to sort the icons prior to updating the resolutions in the image list.

ReplaceIcon uses the Resolutions enumerator to update each of the image resolutions used in the image list. The GetBestIconIndexForSize method is called to determine the icon size used for each image resolution. The ScaleImage method is called to resize the icon to the width required for each image resolution. If the icon is Masked (has transparent areas), the handle for the bitmap mask is included in the image scaling process. The InternalReplace method in the image resolution is called to store the scaled 32-bit RGBA raw image data.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.