Sign in Join
FPDoc Onlineexperiment

TPicture.LoadFromResourceName procedure

Member of TPicturepublicIn unit Graphics

Loads content from the specified resource into the Graphic property.

Declaration

pascal
procedure LoadFromResourceName(Instance: TLCLHandle; 
 const ResName: string)
procedure LoadFromResourceName(Instance: TLCLHandle; 
 const ResName: string; 
 AClass: TGraphicClass)

Arguments

Instance

Handle with the resources examine in the method.

ResName

Name of the resource loaded in the method.

AClass

TGraphic descendant for the image format.

Description

LoadFromResourceName is an overloaded method used to created a TGraphic instance with the content from the specified resource name. Instance is the handle with the resources examined in the method. ResName is the name of the resource loaded in the method.

LoadFromResourceName creates a new TGraphic class instance that is used as the member variable for the Graphics property. The CreateGraphicFromResourceName routine is called to create the graphic and load the named resource from the handle. The Changed method is assigned to the OnChange event handler in the class instance.

An overloaded variant includes an AClass argument with the class type for the TGraphic descendant needed for a supported image format. The LoadFromResourceName method in the class instance is called to load the named resource.

The existing TGraphic instance in Graphic is freed and the new TGraphic instance is used as the member variable. The Changed method is called to signal the OnChange event handler (when assigned).

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.