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

# TCustomIcon.Add

Add - an Icon formatted as AFormat, with specified Height and Width.

## Declaration

Source position: graphics.pp line 1653

`public procedure TCustomIcon.Add(`
`AFormat: TPixelFormat;`
`AHeight: Word;`
`AWidth: Word`
`);`

## Arguments

`AFormat` |  | Pixel format (color depth) for the icon image.
`AHeight` |  | Height in pixels for the icon image.
`AWidth` |  | Width in pixels for the icon image.

## Description

Add is procedure used to create an image for the icon with the attributes specified in AFormat, AHeight, and AWidth. Add calls GetIIndex to determine if an icon image with the requested attributes already exists in the image list for the icon. An EInvalidGraphicOperation exception is raised when the image already exists in the internal image list.

Add calls UnshareImage to release the shared image handle, and adds a new image class instance to the shared icon. If the icon image is the first one in the list, the value in Current is set to 0 (zero) and the UpdateCurrentView method is called.

Use Current to make an icon image active for the class instance. Use AssignImage to store the image at the position in Current.