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

# TCustomImageList.AddSliceCentered

Adds an image centered in the height and width for the image resolutions.

## Declaration

Source position: imglist.pp line 347

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

## Arguments

`Image` |  | Image content added in the method.

## Function result

Ordinal position where the image was stored in the image resolutions.

## Description

AddSliceCentered is an Integer function used to add the specified image to each of the resolutions in the image list.

Image is a TCustomBitmap instance that contains the image data used in the operation. A TRect instance is created which uses the values in the Height and Width properties for the default resolution. The image rectangle is used to center the image content using the height and width for the image.

AddSliceCentered calls the AddSlice method using Image and the calculated image rectangle as arguments. AddSlice scales the image to the dimensions needed for each image resolution, and stores the scaled image data.

The return value contains the ordinal position where the image was stored in each of the images resolutions for the image list.

## See also

TCustomImageListResolutions |  | Provides multiple image resolutions in TCustomImageList.
TCustomImageList.AddSlice |  | Adds a portion of an image to each of the resolutions in the image list.