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

TGraphic.LoadFromResourceID

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

Declaration

Source position: graphics.pp line 852

public procedure TGraphic.LoadFromResourceID(

  Instance: THandle;

  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 3.2 Generated 2024-02-25 Home