Sign in Join
FPDoc Onlineexperiment

TCustomImageList.AddResourceName function

Member of TCustomImageListpublicIn unit ImgList

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

Declaration

pascal
function 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.

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

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.