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

# TCustomIcon.SetHandle

Unshares an existing shared image handle and set the new value.

## Declaration

Source position: graphics.pp line 1646

`protected procedure TCustomIcon.SetHandle(`
`AValue: TLCLHandle`
`); override;`

## Arguments

`AValue` |  | New value for the shared image handle in the icon.

## Description

SetHandle is a method used to set set the value for the shared image handle in the icon instance. It ensures that an existing shared image handle frees both its canvas context and the data in its TSharedImage instance.

It calls UpdateHandle to set the new shared handle for the icon instance to AValue. Values in Current and Count are reset when the handle is changed. Current is set 0 when multiple images are used in the icon. It is set to -1 when a single image is present. Changed is called to update the value in Modified and signal the OnChange event handler (when assigned).

## Version info

Modified in LCL version 4.0 to use the TLCLHandle type instead of the deprecated THandle type in the AValue parameter.

## See also

TRasterImage.SetHandle |  | Sets the handle used for the image.
LCLType.TLCLHandle |  | Alias to the TLCLHandle type defined for widgetset references.
WSReferences.TLCLHandle |  | The type used for handles in LCL applications, components, controls, and widget set classes.