[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Graphics' (#lcl)

# TPicture.LoadFromResourceName

Loads content from the specified resource into the Graphic property.

## Declaration

Source position: graphics.pp line 918

`public procedure TPicture.LoadFromResourceName(`
`Instance: TLCLHandle;`
`const ResName: string`
`); procedure TPicture.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.

## 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).

## Version info

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

## See also

TPicture.Changed |  | Performs actions needed when value(s) in the class instance have been modified.
TGraphic.OnChange |  | Event handler signalled when data in the class instance is changed.
TGraphic.LoadFromResourceName |  | Loads a resource with the specified name from the given handle.
CreateGraphicFromResourceName |  | Creates and loads a TGraphic instance with the content from the specified resource instance handle and resource name.
LCLType.TLCLHandle |  | Alias to the TLCLHandle type defined for widgetset references.
WSReferences.TLCLHandle |  | The type used for handles in LCL applications, components, controls, and widget set classes.