[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 932

public procedure TPicture.LoadFromResourceName(

  Instance: THandle;

  const ResName: string

);

procedure TPicture.LoadFromResourceName(

  Instance: THandle;

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