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

# TGraphic.LoadFromResourceID

Loads graphic data from a resource identified by the integer identifier ResID.

## Declaration

Source position: graphics.pp line 838

`public procedure TGraphic.LoadFromResourceID(`
`Instance: TLCLHandle;`
`ResID: PtrInt`
`); virtual;`

## Arguments

`Instance` |  | Handle where the content for the resource is stored.
`ResID` |  | Pointer to the Integer Resource ID for the resource.

## Description

LoadFromResourceID is a procedure used to load a resource with the specified Resource ID into the class instance. Instance contains the Handle used to read the resource. LoadFromResourceName calls GetResourceType to get the Integer resource type used in the class instance. No actions are performed in the method when the TResourceType value is unassigned (contains Nil).

LoadFromResourceName creates a temporary TResourceStream that is used to load the content for the class instance by calling the LoadFromStream method. The value in ResID is located in the resource, and its resource handle is used to get the content stored in the stream.

An EResNotFound exception is raised during stream initialization if the resource type or the resource handle is invalid.

Use LoadFromResourceName to load a resource with a given resource name.

Use LoadFromLazarusResource to load a Lazarus resource from a .lrs file with a give name.

## Errors

Raises an EResNotFound exception when the TResourceStream is initialized if the resource type or the resource handle is invalid.

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

TGraphic.GetResourceType |  | Gets the Integer Resource Type for the class instance.
TGraphic.LoadFromStream |  | Reads graphic data from a stream.
TGraphic.LoadFromResourceName |  | Loads a resource with the specified name from the given handle.
TGraphic.LoadFromLazarusResource |  | Load the graphic data from a Lazarus Resource (.lrs) file.
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.
TResourceStream