IWxView.DrawOnGraphics

Syntax

DrawOnGraphics(Graphics: IGxGraphics);

Parameters

Graphics. Graphical context.

Description

The DrawOnGraphics method draws a workspace within a graphical context.

Example

Executing the example requires a form with the Button1 button, the WorkspaceBox component named WorkspaceBox1 and a data source for the WorkspaceBox1. The file system should contain the C:\WSP.png image.

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

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    ws: IWxWorkspace;
    view: IWxView;

    ellipse: IWxEllipse;
    Img: IGxImage;
    Graph: IGxGraphics;
Begin
    
// Get workspace for editing
    ws := UiWorkspace1.WxWorkspace;
    view := ws.CreateView;

    ellipse := ws.CreateEllipse;
    view.AutoScaleAndScroll;
    Img := GxBitmap.CreateNew(
300300, GxPixelFormat.Format32bppArgb);
    Graph := GxGraphicsClass.FromImage(Img);
    View.DrawOnGraphics(Graph);
    Img.SaveToFileEncoded(
"C:\WSP.png", GxImageFormats.Png);
End Sub Button1OnClick;

After executing the example the part of workspace image of defined size is saved to the file.

See also:

IWxView