Skip to main content

TcxCustomImageList.LoadImage(THandle,string,TColor,Integer,TLoadResources) Method

Loads a specific image from the specified resource module.

Declaration

function LoadImage(AInstance: THandle; const AResourceName: string; AMaskColor: TColor = clDefault; AWidth: Integer = 0; AFlags: TLoadResources = []): Boolean;

Parameters

Name Type Description
AInstance THandle

A handle to the resource module.

AResourceName string

A resource name.

AMaskColor TColor

The transparency mask color.

AWidth Integer

The width of new images, in pixels.

AFlags TLoadResources

Stores image load settings.

Returns

Type Description
Boolean

True if the function successfully loads and appends one or more images to the image list; otherwise, False.

Remarks

Unlike the GetInstRes function, LoadImage can load only a bitmap resource whose name within the package is passed as the AResourceName parameter. The LoadImage function treats the image’s upper-left pixel color as the mask color. You can use the AMaskColor optional parameter to specify the color used to generate a transparency mask bitmap for the loaded image.

Note

The image’s transparency mask bitmap is ignored if the Masked property is set to False.

You can use the optional ALoadFlags parameter to pass additional image load settings. Refer to the TLoadResource type description for detailed information on available options.

This function divides the loaded image into multiple images or truncates it to match the list’s dimensions as the Add function does. The LoadImage function uses the Width property value as the default width of appended images.

Note

The LoadImage, GetInstRes, and ResInstLoad functions are designed to load images from packaged resources. To load an image from an individual resource file, call the ResourceLoad or FileLoad function instead.

See Also