[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: THandle;

  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 THandle value for the resource.

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.

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 using the specified instance handle and resource name.


Version 3.2 Generated 2024-02-25 Home