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

# TCustomIcon.SetSize

Sets the size (width, height) for the image in the Icon.

## Declaration

Source position: graphics.pp line 1660

`public procedure TCustomIcon.SetSize(`
`AWidth: Integer;`
`AHeight: Integer`
`); override;`

## Arguments

`AWidth` |  | New Width for the icon.
`AHeight` |  | New Height for the icon.

## Description

SetSize is an overridden method used to set the size for the image in the icon to the values specified in AWidth and AHeight. SetSize implements the abstract virtual method defined in the ancestor class. SetSize stores the argument values in an internal member used to track the requested icon image size used in the GetBestIndexForSize method.

SetSize raises an EInvalidGraphicOperation exception when an icon size has been selected by setting a value in the Current property.

SetSize is called from the ReadStream method.

## Errors

Raises an EInvalidGraphicOperation with the message in rsIconImageSizeChange when Current contains a value other than -1.

## See also

TCustomIcon.Current |  | Ordinal position for the current image displayed for the icon.
TCustomIcon.ReadStream |  | Reads the content for the icon from the specified stream.
TCustomIcon.GetBestIndexForSize |  | Gets the ordinal position for the image closest to the requested size.
TRasterImage.SetSize |  | SetSize - specifies height and width of Image.
EInvalidGraphicOperation |  | EInvalidGraphicOperation - exception handler for invalid graphic operation.
rsIconImageSizeChange