IImageList.LoadFromStream

Syntax

LoadFromStream(Stream: IIOStream; [Transparent: IGxColor = Null]);

Parameters

Stream. The parameter determines the stream image, from which the image is loaded to the component.

Transparent. This parameter determines the color to be used as transparent.

Description

The LoadFromStream method loads an image to the component from the stream that is passed as the Stream input parameter.

Example

Executing the example requires that the repository contains resources with the RES_IMG identifier. Those resources should contain graphical element with the img_0 identifier and the size 16x16 pixels.

Executing the example requires a form containing the ImageList component with the ImageList1 identifier.

Add links to the Drawing, Io, Metabase system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    Resource: IResourceObject;
    Binaries: IResourceBinaries;
    Color: IGxColor;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Get resources
    Resource := mb.ItemById("RES_IMG").Bind As IResourceObject;
    // Get image from resources
    Binaries := Resource.Binaries;
    // Clear the ImageList1 component
    ImageList1.Clear;
    // Set height and width of images in the ImageList1 component
    ImageList1.Height := 16;
    ImageList1.Width := 16;
    // Load image from resources to the ImageList1 component  
    ImageList1.LoadFromStream(Binaries.Value("img_0"));
    Color := GxColor.FromName("White");
    // Save this image to the file
    ImageList1.SaveToDoc("C:\Image from resources.jpg", Color);
End Sub UserProc;

After executing the example the img_0 graphical element from resources will be loaded to the ImageList1 component. Then it will be saved to the C:\Image from resources.jpg file from the component.

See also:

IImageList