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

# TCustomImageList.AddResourceName

Adds a graphic from a resource with the specified resource name.

## Declaration

Source position: imglist.pp line 352

`public function TCustomImageList.AddResourceName(`
`Instance: TLCLHandle;`
`const ResourceName: string;`
`MaskColor: TColor = clNone`
`):Integer;`

## Arguments

`Instance` |  | Handle for the resource.
`ResourceName` |  | Name of the resource loaded in the method.
`MaskColor` |  | Color for transparent areas in the image, clNone for an opaque image.

## Function result

Ordinal position where the image was stored.

## Description

AddResourceName is an Integer function used to load and store a TGraphic for the specified resource name.

Instance is a TLCLHandle value with the handle for the resource where an image is stored.

ResourceName is a String value that contains the name for the resource loaded in the method.

MaskColor is a TColor value used transparent areas in the graphic. The default value for the property is clNone, and indicates the graphic is rendered as an opaque (solid) image.

AddResourceName calls the CreateGraphicFromResourceName routine to get the image for the resource name specified in ResourceName. The return value may be either a TGraphic or a TCustomBitmap class instance.

When the image is a TCustomBitmap, the value in MaskColor is stored in the bitmap and transparency is enabled when the color is not clNone. MaskColor is not used when the return value is a TGraphic instance; TGraphic does not support transparency.

AddResourceName calls the appropriate method to store the image type in the image list. When TCustomBitmap is used, the Add method is called. When TGraphic is used, the AddIcon method is called. The return value contains the ordinal position in the image list where the image was stored.

## Version info

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

## See also

TCustomImageList.Add |  | Adds an image to the list using its source data and optional mask.
TCustomImageList.AddIcon |  | Adds an icon to the image list.
CreateGraphicFromResourceName |  | Creates and loads a TGraphic instance with the content from the specified resource instance handle and resource name.
TLCLHandle |  | The type used for handles in LCL applications, components, controls, and widget set classes.