IMetabaseObjectDescriptor.Screenshot

Syntax

Screenshot(Type: ScreenshotType): Variant;

Parameters

Type. Type where image is stored.

Description

The Screenshot property determines the image used on previewing repository object.

Comments

Preview is presenting repository objects as extra large icons.

To get if repository objects can be previewed as large icons, use the IMetabase.IsScreenshotSupported property.

When repository objects are added to update, their preview images are not added to the update by default because they are not part of metadata. If it is required to include a preview image to the update, use the IMetabaseUpdateObjectNode.IncludeScreenshot property.

Example

Executing the example requires a form with the Button1 button and the ImageBox component named ImageBox1. The repository should contain a regular report with the REGULAR_REPORT identifier and have a possibility to display objects as icons without taking into account access permissions.

Add links to the IO, Metabase system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    MDesc: IMetabaseObjectDescriptor;
    Scr: Variant;
    Stream: IIOStream;
Begin
    MB := MetabaseClass.Active;
    MDesc := MB.ItemById("REGULAR_REPORT");
    If MB.IsScreenshotSupported = True Then
        Scr := MDesc.Screenshot(ScreenshotType.Default_);
        If Not (Scr.IsNull) Then
            Stream := IOStream.FromVariant(Scr);
            ImageBox1.LoadImageFromStream(Stream);
        End If;
    Else
        Debug.WriteLine("Possibility to display objects as icons is unavailable.");
    End If;
End Sub Button1OnClick;

Clicking the button places an image for preview of the report with the REGULAR_REPORT identifier to the ImageBox1 component.

See also:

IMetabaseObjectDescriptor