Shape Class
Represents a shape, such as Rectangle or Line.
public class Shape : Element, Inline, DrawingElement
Public Class Shape
Inherits Element, Inline, DrawingElement
- Inheritance:
- Shape
- Derived
Remarks
Shape's type (geometry) is represented by ShapeType enumeration. It can be set only through Shape(DocumentModel, ShapeType, Layout) constructor and retrieved from ShapeType property.
Shape can be filled with a Brush and outlined with a Pen.
Shape can be positioned in-line with the rest of the document content or floating within document content. For more information, see remarks for Layout property.
For more information about shapes and layout, see shapes and layout article and shapes example.
Constructors
Shape(DocumentModel, ShapeType, Layout)
Initializes a new instance of the Shape class.
public Shape(DocumentModel document, ShapeType shapeType, Layout layout)
Public Sub New(document As DocumentModel, shapeType As ShapeType, layout As Layout)
Parameters
document
- DocumentModel
The owner document.
shapeType
- ShapeType
Type of the shape.
layout
- Layout
The shape's layout (position and size).
Exceptions
layout
is null.
Properties
AdjustValues
Gets the shape's adjust values.
public IDictionary<string, double> AdjustValues { get; }
Public ReadOnly Property AdjustValues As IDictionary(Of String, Double)
Property Value
The shape's adjust values.
Remarks
Adjust value is a varying parameter used in calculation of shape's geometry which is specified using Drawing ML.
Each ShapeType defines its own set of adjust values (and some/most do not have any).
See Also
ElementType
public override ElementType ElementType { get; }
Public Overrides ReadOnly Property ElementType As ElementType
Property Value
The Shape value.
Overrides
Fill
Gets the Brush that specifies how the shape's interior is filled.
Property Value
Outline
Gets the Pen that specifies the shape's outline.
Property Value
ShapeType
Gets the type of the shape.
Property Value
The type of the shape.
Methods
Clone(Boolean)
Clones this Shape instance.
public Shape Clone(bool cloneDescendants)
Public Function Clone(cloneDescendants As Boolean) As Shape
Parameters
cloneDescendants
- Boolean
If set to true clone all descendants recursively; otherwise clone only current Shape.
Returns
Remarks
Document content element instance can exist only in a one place in the document.
If you want to insert document content element into some other part of the same document, then clone the element and insert its clone.
If you want to insert document content element into another document, then you should first import it into another document with Import<T>(T, Boolean, Boolean) method and then insert the imported element.
For more information, see cloning example.