Sign in Join
FPDoc Onlineexperiment

CreateGraphicFromResourceName function

In unit Graphics

Creates and loads a TGraphic instance with the content from the specified resource instance handle and resource name.

Declaration

pascal
function CreateGraphicFromResourceName(Instance: TLCLHandle; 
 const ResName: string): TGraphic

Description

CreateGraphicFromResourceName calls the RTL FindResource routine to get an FPC resource handle for the LCL handle in Instance and the resource with the name in ResName.

Both Icon and Cursor group resource types are checked using FindResource. When a valid resource handle (one with a non-zero value) is available, a TIcon or TCursorImage instance is created and used as the return value for the routine. The LoadFromResourceHandle method in the class instance is called to load the image content for the resource.

If a handle is not found for an Icon or a Cursor resource type, the CreateBitmapFromResourceName routine is called to create and load the content in the TGraphic instance.

CreateGraphicFromResourceName is used in the implementation of the TCustomImageList.AddResourceName method.

See also

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.