IMetabaseObjectDescriptor.Screenshot

Syntax

Screenshot(Type: ScreenshotType): Variant;

Screenshot[Type: Prognoz.Platform.Interop.Metabase.ScreenshotType]: Object;

Parameters

Type. Type where image is stored.

Description

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

Comments

Preview is presenting of repository objects as large icons.

To get whether repository objects are displayed as large icons, use the IMetabase.IsScreenshotSupported property.

On adding repository objects to the update, their preview images are not added to the update, because they are parts of metadata. After the update is applied, new preview images are created for reports, if this possibility is available in target repository.

NOTE. For objects which preview images are set in application code, after the update is applied it is necessary to re-install those images.

Example

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

Add links to the IO, Marshalers, 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("Objects cannot be displayed as extra large icons.");
    End If;
End Sub Button1OnClick;

Imports Prognoz.Platform.Interop.ForeIO;
Imports Prognoz.Platform.Interop.Marshalers;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    MB: IMetabase;
    MDesc: IMetabaseObjectDescriptor;
    Scr: Object;
    ImgStream: IIOStream;
    IOStrClass: IOStreamClass = New IOStreamClass();
    IOStreamMarsh: ForeIOStreamMarshaler = New ForeIOStreamMarshaler();
Begin
    MB := Self.Metabase;
    MDesc := MB.ItemById["REGULAR_REPORT"];
    If MB.IsScreenshotSupported = True Then
        Scr := MDesc.Screenshot[ScreenshotType.stDefault];
        If Scr <> Null Then
            ImgStream := IOStrClass.FromVariant(Scr);
            PictureBox1.Image := Image.FromStream(IOStreamMarsh.ForeToManaged(ImgStream));
        End If;
    Else
        System.Diagnostics.Debug.WriteLine("Objects cannot be displayed as extra large icons.");
    End If;
End Sub;

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

See also:

IMetabaseObjectDescriptor