Back to Devexpress

ShapeCollection.Remove(Shape) Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-shapecollection-dot-remove-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-shape-x29.md

latest2.0 KB
Original Source

ShapeCollection.Remove(Shape) Method

Removes the specified shape from the collection.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
bool Remove(
    Shape shape
)
vb
Function Remove(
    shape As Shape
) As Boolean

Parameters

NameTypeDescription
shapeShape

A shape to remove.

|

Returns

TypeDescription
Boolean

true if the element is found and successfully removed; otherwise, false.

|

Remarks

The following code example removes all shape groups from the collection:

csharp
Document document = wordProcessor.Document;
ShapeCollection shapes = document.Shapes;
for (int i = shapes.Count - 1; i >= 0; i--)
{
    if (shapes[i].Type == ShapeType.Group)
        shapes.Remove(shapes[i]);
}
vb
Dim document As Document = wordProcessor.Document
Dim shapes As ShapeCollection = document.Shapes
For i As Integer = shapes.Count - 1 To 0 Step -1
    If shapes(i).Type = ShapeType.Group Then
        shapes.Remove(shapes(i))
    End If
Next i

See Also

ShapeCollection Interface

ShapeCollection Members

DevExpress.XtraRichEdit.API.Native Namespace