IGxImageList.SaveToDoc

Syntax

SaveToDoc(Value: String; BgColor: IGxColor): Boolean;

Parameters

Value. Path to the file where the image is to be stored.

BgColor. Image background color. If Null is sent as background color, the color selection is random.

Description

The SaveToDoc method saves all images from the collection to the file, which path is passed as the Value input parameter. All images are saved as horizontal series and the method returns the attribute that images are stored successfully.

Example

Executing the example requires a form with the button named Button1, the ImageList component named ImageList1 and a set of images from the collection. For details about image loading to the component see the ImageList section. Add links to the Drawing, Forms, Io system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    ImgList: IGxImageList;
    Str: IIOStream;
Begin
    ImgList := New GxImageList.Create;
    Str := New MemoryStream.Create;
    // Send icons to collection of images via the stream
    ImageList1.SaveToStream(Str, GxColor.FromName("White"));
    ImgList.LoadFromStream(Str);
    // Remove one image from collection and save the rest to file
    ImgList.Remove(1);
    ImgList.SaveToDoc("C:\temp\1.bmp", GxColor.FromName("White"));
    // Display the number of images in collection and sizes of the first image to the console
    Debug.WriteLine("Number of images in collection: " + ImgList.Count.ToString);
    Debug.WriteLine("Size:");
    Debug.WriteLine("Width: " + ImgList.Item(0).Size.Width.ToString);
    Debug.WriteLine("Height: " + ImgList.Item(0).Size.Height.ToString);
End Sub Button1OnClick;

Clicking the button removes an image from the collection and all of the rest images are saved as horizontal series to the selected file:

The console window displays the number of images in the file and sizes of the first image.

See also:

IGxImageList