IWxViewExporter.GetBitmap

Syntax

GetBitmap: IGxBitmap;

GetBitmap: Prognoz.Platform.Interop.Drawing.IGxBitmap;

Description

The GetBitmap method returns graphical image of a workspace.

Example

Executing the example requires a form with the Button1 button, the WorkspaceBox component named WorkspaceBox1 and a data source for the WorkspaceBox1. The workspace must contain several objects.

Add links to the Andy, Drawing, Workspace system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    ws: IWxWorkspace;
    view: IWxView;
    Exp: IWxViewExporter;
    arrow: IWxArrow;
    ellipse: IWxEllipse;
Begin
    ws := UiWorkspace1.WxWorkspace;
    view := ws.Views.Item(0);
    ellipse := ws.CreateEllipse;
    arrow := ws.CreateArrow;
    Arrow.FirstPoint := New GxPointF.Create(1010);
    Arrow.LastPoint := New GxPointF.Create(319);
    Exp := New WxViewExporter.Create;
    Exp.WxView := View;
    ImageBox1.Image := Exp.GetBitmap;
End Sub Button1OnClick;
Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Workspace;

 
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    ws: IWxWorkspace;
    view: IWxView;
    arrow: IWxArrow;
    ellipse: IWxEllipse;
    PinPoint: GxPointF = 
New GxPointFClass();
    Exp: WxViewExporter = 
New WxViewExporter();
    ImgStream: System.IO.Stream = 
New System.IO.MemoryStream();
    Bmp: GxBitmap;
Begin
    ws := uiWorkspaceNet1.WxWorkspace;
    view := ws.Views.Item[
0];
    ellipse := ws.CreateEllipse();
    arrow := ws.CreateArrow();
    PinPoint.Create(
1010);
    Arrow.FirstPoint := PinPoint;
    PinPoint.Create(
319);
    Arrow.LastPoint := PinPoint;
    Exp.WxView := view;
    Bmp := Exp.GetBitmap();
    Bmp.SaveToStream(ImgStream);
    PictureBox1.Image := Image.FromStream(ImgStream);
End Sub;

After executing this example, graphical image of the workspace, displayed in the WorkspaceBox1 component is loaded into the ImageBox1 component.

See also:

IWxViewExporter