.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

ShapeCollection.AddShape(ShapeGeometryPreset, Single, Single, Single, Single) Method

Inserts a shape with a specific geometry type.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v20.2.Core.dll


Shape AddShape(
    ShapeGeometryPreset shapePreset,
    float x,
    float y,
    float width,
    float height
Function AddShape(
    shapePreset As ShapeGeometryPreset,
    x As Single,
    y As Single,
    width As Single,
    height As Single
) As Shape


Name Type Description
shapePreset ShapeGeometryPreset

One of the ShapeGeometryPreset enumeration values indicating the shape's geometry type.

x Single

A Single value indicating the distance from the left of the worksheet.

y Single

A Single value indicating the distance from the top of the worksheet.

width Single

A Single value that is shape's width.

height Single

A Single value that is the shape's height.


Type Description

A Shape object that is the resulting shape.



The ISpreadsheetComponent.Unit property determines the units of linear dimensions (x, y, width, height).

Use the Shape.ShapeType property to determine a drawing object's type in ShapeCollection. The ShapeGeometry.Preset property returns the shape's geometry type.

Change the shape's fill and outline settings using the Shape.Fill and Shape.Outline properties.

The Shape.Rotation property allows you to define the shape's rotation angle.

Delete the shape using the ShapeCollection.RemoveAt or Shape.Delete method.


The code sample below shows how to create a shape and adjust its appearance.


Shape shape = worksheet.Shapes.AddShape(ShapeGeometryPreset.DownArrow, 100, 0, 500, 500);

// Define the shape's fill and outline color.
shape.Fill.SetGradientFill(ShapeGradientType.Circle, Color.Chocolate, Color.Beige);

// Specify the shape's rotation angle.
shape.Rotation = -60;
See Also