IWxShape.Picture

Syntax

Picture: IGxImage;

Picture: Prognoz.Platform.Interop.Drawing.IGxImage;

Description

The Picture property determines the image to be used as a shape fill.

Example

Executing the example requires that repository contains a workspace with the WSP identifier containing shape. It is also required to have the ConnectedCPs.gif image.

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

Sub UserProc;
Var
    mb: Imetabase;
    wsp: IWxWorkspace;
    Shape: IWxShape;
Begin
    // Get workspace for editing
    mb := MetabaseClass.Active;
    wsp := mb.ItemById("WSP").Edit As IWxWorkspace;
    wsp.BeginUpdate;
    Shape := wsp.Shapes.Item(0);
    Shape.Picture := New GxImage.CreateFromFile("C:\ConnectedCPs.gif");
    Shape.Style.PictureStretch := True;
    Shape.TransparentColor := GxColor.FromName("Red");
    wsp.EndUpdate;
    // Save changes
    (wsp As IMetabaseObject).Save;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Andy;

 
Public Shared Sub Main(Params: StartParams);
Var
    mb: Imetabase;
    wsp: IWxWorkspace;
    Shape: IWxShape;
    Img: GxImage;
    Color: GxColorClassClass = 
New GxColorClassClass();
Begin
    
// Get workspace for editing
    mb := Params.Metabase;
    wsp := mb.ItemById[
"WSP"].Edit() As IWxWorkspace;
    wsp.BeginUpdate();
    Shape := wsp.Shapes.Item[
0];
    Img := 
New GxImageClass_2();
    Img.CreateFromFile(
"C:\ConnectedCPs.gif");
    Shape.Picture := Img;
    Shape.Style.PictureStretch := 
True;
    Shape.TransparentColor := Color.FromName(
"Red");
    wsp.EndUpdate();
    
// Save changes
    (wsp As IMetabaseObject).Save();
End Sub;

After executing the example an image, which will be stretched if the shape is resized, is used as a shape fill. Red color will be transparent in the image.

See also:

IWxShape

IWxShape.TransparentColor