IWxView.SetBackgroundImage

Fore Syntax

SetBackgroundImage(Rect: IGxRect; BackgroundBitmap: IGxBitmap);

Fore.NET Syntax

SetBackgroundImage(Rect: Prognoz.Platform.Interop.Drawing.GxRect; BackgroundBitmap: Prognoz.Platform.Interop.Drawing.GxBitmap);

Parameters

Rect. Rectangle that defines the part of the image to be set as the background.

BackgroundBitmap. The image to be set as the background.

Description

The SetBackgroundImage method sets the specified part of the image as the background for the workspace.

Comments

Use the IWxView.AutoScroll method to put an image to the center of the workspace without changing zoom.

Fore Example

Executing the example requires a form with the Button1 button, the WorkspaceBox component with the WorkspaceBox1 identifier and the UiWorkspaceOblect component with the UiWorkspaceOblect1 identifier. Set UiWorkspaceOblect1 as a data source for the WorkspaceBox1 component. This example is a handler of the OnClick event for the Button1 component.

Add a link to the Drawing system assembly.

Var
    View: IWxView;
    Rect: IGxRect;
    Bmp: IGxBitmap;
Begin
    View := WorkspaceBox1.View;
    Rect := New GxRect.Create(00, WorkspaceBox1.ClientWidth, WorkspaceBox1.ClientHeight);
    Bmp := GxBitmap.FromFile("c:\Background.jpg"As IGxBitmap;
    View.BeginUpdate;
    View.SetBackgroundImage(Rect, Bmp);
    View.EndUpdate;
End Sub Button1OnClick;

On clicking the button the selected image is set as the background for the workspace. Size of the image part, which is set as the background, corresponds to client-based size of the WorkspaceBox1 component.

Fore.NET Example

Executing the example requires a form with the Button1 button, the WorkspaceBoxNet component with the WorkspaceBox1Net identifier and the UiWorkspaceOblectNet component with the UiWorkspaceOblectNet1 identifier. Set UiWorkspaceOblectNet1 as a data source for the WorkspaceBoxNet1 component. The example is a handler of the Click event for the button1 component.

Add links to the Andy, Drawing system assemblies.

Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.Drawing;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    View: IWxView;
    GxRectCls: GxRectClass = New GxRectClass();
    GxBitmapCls: GxBitmapClassClass = New GxBitmapClassClass();
    Bmp: GxBitmap;
Begin
    View := WorkspaceBoxNet1.View;
    GxRectCls.Create(00, WorkspaceBoxNet1.CtrlBox.ClientWidth, WorkspaceBoxNet1.CtrlBox.ClientHeight);
    Bmp := GxBitmapCls.FromFile("c:\Background.jpg");
    View.BeginUpdate();
    View.SetBackgroundImage(GxRectCls, Bmp);
    View.EndUpdate();
End Sub;

On clicking the button the selected image is set as the background for the workspace. Size of the image part, which is set as the background, corresponds to client-based size of the WorkspaceBoxNet1 component.

See also:

IWxView