How to: Create a Shape
Create a Shape
The code sample below illustrates how to use the ShapeCollection.AddShape method to create a shape.
Worksheet worksheet = spreadsheetControl1.Document.Worksheets; Shape shape = worksheet.Shapes.AddShape(ShapeGeometryPreset.RectangularCallout, 100, 100, 500, 500);
Change a Shape’s Form
Use the ShapeGeometry.Preset property to change the drawing object’s geometry type. The code sample below shows how to modify a callout to an End action button.
Resize and Rotate a Shape
Use the following properties to rotate and resize a shape similarly to what appears on the image below.
- Shape.Rotation - changes the shape’s rotation angle.
- FloatingObject.Width, FloatingObject.Height - specifies the shape’s width and height.
You can provide a text for a shape. Refer to the How to: Add Text to a Shape topic for more information.