IWxShape.CreateExtension

Syntax

CreateExtension([ProgId: String = ""]);

CreateExtension(ProgId: string);

Parameters

ProgId. Class of the object, for which an extension is created.

By default, an extension is created for repository objects. An extension for repository objects can also be created by setting this parameter value to KeWsp.WxMetabaseObject.

Description

The CreateExtension method creates an extension for a workspace shape.

Comments

This method is used to arrange various objects in the workspace. After creating an extension use the IWxShape.Extension property to define the object corresponding to workspace shape.

In the current version extensions are created to display on the workspace shapes corresponding to repository objects.

Example

Executing the example requires a form with the Button1 button, the WorkspaceBox component named WorkspaceBox1 and a data source for the WorkspaceBox1. The repository contains a form with the Form_1 identifier.

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

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    MbObj: IMetabaseObject;
    Shape: IWxShape;
    WxObj: IWxMetabaseObject;
    Style: IWxStyle;
    ws: IWxWorkspace;
Begin
    //Arrange and format repository object on the workspace
    ws := WorkspaceBox1.View.Workspace;
    ws.BeginUpdate;
    Mb := MetabaseClass.Active;
    MbObj := Mb.ItemById("Form_1"As IMetabaseObject;
    Shape := ws.CreateRectangle;
    Shape.CreateExtension;
    WxObj := Shape.Extension As IWxMetabaseObject;
    WxObj.MetabaseObject := MbObj;
    Shape.Id := "Form";
    //Create a style
    Style := ws.CreateStyle;
    Style.ShadowBrushForeColor := GxColor.FromName("Blue");
    Style.ShadowBrushForeTransparent := 50;
    Style.LinePenTransparent := 100;
    Style.TextAlignmentVertical := GxAlignment.Far;
    Shape.Style := Style;
    ws.EndUpdate;
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
    MB: IMetabase;
    MbObj: IMetabaseObject;
    Shape: IWxShape;
    WxObj: IWxMetabaseObject;
    Style: IWxStyle;
    ws: IWxWorkspace;
    Color: GxColorClassClass = 
New GxColorClassClass();
Begin
    
//Arrange and format repository object on the workspace
    ws := workspaceBoxNet1.View.Workspace;
    ws.BeginUpdate();
    Mb := Self.Metabase;
    MbObj := Mb.ItemById[
"Form_1"As IMetabaseObject;
    Shape := ws.CreateRectangle();
    Shape.CreateExtension(
"KeWsp.WxMetabaseObject");
    WxObj := Shape.Extension 
As IWxMetabaseObject;
    WxObj.MetabaseObject := MbObj;
    Shape.Id := 
"Form";
    
//Create a style
    Style := ws.CreateStyle();
    Style.ShadowBrushForeColor := Color.FromName(
"Blue");
    Style.ShadowBrushForeTransparent := 
50;
    Style.LinePenTransparent := 
100;
    Style.TextAlignmentVertical := GxAlignment.walFar;
    Shape.Style := Style;
    ws.EndUpdate();
End Sub;

After executing the example the repository object is positioned in the workspace.

See also:

IWxShape.Extension | IWxShape