IWxShapes.RemoveById

Fore Syntax

RemoveById(Id: String): Boolean;

Fore.NET Syntax

RemoveById(Id: String): Boolean;

Parameters

Id. Shape identifier.

Description

The RemoveById method removes a shape by identifier and returns whether the removal is successful.

Comments

The method returns False when a shape with identifier, passed with the Id parameter, is missing in the workspace.

Fore Example

Executing the example requires the object of the workspace type. Create a form, add the Button1 button to it, the WorkspaceBox component named WorkspaceBox1, the UiWorkspaceObject component named UiWorkspaceObject1, define the workspace as an object of the UiWorkspaceObject1 component, the UiWorkspaceObject1 component as the source of the WorkspaceBox1 component, and set the True value for the Active property of the UiWorkspaceObject1 component. Add links to the Collections, Metabase and Workspace system assemblies.

Class OBJ48413Form: Form
    UiWorkspaceObject1: UiWorkspaceObject;
    WorkspaceBox1: WorkspaceBox;
    Button1: Button;

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Begin
        text := WorkspaceBox1.View.Workspace.Shapes.RemoveById("New_Shape").ToString;
    End Sub Button1OnClick;

End Class OBJ48413Form;

On clicking the Button1 button, the shape with the New_Shape identifier is removed from the WorkspaceBoxNet1 component area and the removal result is shown in the window header text.

Fore.NET Example

Executing the example requires the object of the workspace type. Create a form, add the Button1 button to it, the WorkspaceBoxNet component named WorkspaceBoxNet1,  the UiWorkspaceObjectNet component named UiWorkspaceObjectNet1, define the workspace as an object of the UiWorkspaceObjectNet1 component, the UiWorkspaceObjectNet1 component as the source of the WorkspaceBoxNet1 component, and set the True value for the Active property of the UiWorkspaceObjectNet1 component. Add links to the Collections, Metabase and Workspace system assemblies.

Imports System;
Imports System.Collections.Generic;
Imports System.ComponentModel;
Imports System.Data;
Imports System.Drawing;
Imports System.Text;
Imports System.Windows.Forms;
Imports Prognoz.Platform.Forms.Net;
Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Workspace;

Public Partial Class OBJ995Form: Prognoz.Platform.Forms.Net.ForeNetForm
    
Public Constructor OBJ995Form();
    
Begin
        InitializeComponent();
    
End Constructor;

    
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
    
Begin
        text := WorkspaceBoxNet1.View.Workspace.Shapes.RemoveById(
"New_Shape").ToString();
    
End Sub;

End Class;

On clicking the Button1 button, the shape with the New_Shape identifier is removed from the WorkspaceBoxNet1 component area and the removal result is shown in the window header text.

See also:

IWxShapes