IWxSelectedShapes.Add

Syntax

Add(Value: IWxShape);

Add(Value: Prognoz.Platform.Interop.Andy.IWxShape);

Parameters

Value. Shape.

Description

The Add method adds a shape to a collection of selected shapes.

Example

Executing the example requires a form with the Button1 button, the WorkspaceBox component and the UiWorkspace component named UiWorkspace1, which is a data source for WorkspaceBox.

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

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    ws: IWxWorkspace;
    Rect: IWxRectangle;
    Ellipse: IWxEllipse;
    pos: IGxPointF;
    SelectS: IWxSelectedShapes;
Begin
    ws := UiWorkspace1.WxWorkspace;
    ws.BeginUpdate;
    Rect := ws.CreateRectangle;
    pos := 
New GxPointF.Create(2010);
    Rect.PinPosition := pos;
    Rect.Text := 
"Rectangle";
    Ellipse := ws.CreateEllipse;
    pos := 
New GxPointF.Create(4050);
    Ellipse.PinPosition := pos;
    Ellipse.Text := 
"Ellipse";
    SelectS := WorkspaceBox1.View.SelectedShapes;
    SelectS.Add(Ellipse);
    SelectS.Add(Rect);
    SelectS.Align(WxShapesAlignment.VerticalCenter);
    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
    ws: IWxWorkspace;
    Rect: IWxRectangle;
    Ellipse: IWxEllipse;
    SelectS: IWxSelectedShapes;
    pos: GxPointF = 
New GxPointFClass();
Begin
    ws := uiWorkspaceNet1.WxWorkspace;
    ws.BeginUpdate();
    Rect := ws.CreateRectangle();
    pos.Create(
2010);
    Rect.PinPosition := pos;
    Rect.Text := 
"Rectangle";
    Ellipse := ws.CreateEllipse();
    pos.Create(
4050);
    Ellipse.PinPosition := pos;
    Ellipse.Text := 
"Ellipse";
    SelectS := workspaceBoxNet1.View.SelectedShapes;
    SelectS.Add(Ellipse);
    SelectS.Add(Rect);
    SelectS.Align(WxShapesAlignment.wsaVerticalCenter);
    ws.EndUpdate();
End Sub;

After executing the example the created objects are selected and aligned to the vertical center.

See also:

IWxSelectedShapes