GemBox.Document
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    Shape Class

    Namespace:
    GemBox.Document.Drawing
    Assembly:
    GemBox.Document.dll

    Represents a shape, such as Rectangle or Line.

    • C#
    • VB.NET
    public class Shape : DrawingElement
    Public Class Shape
        Inherits DrawingElement
    Inheritance:
    System.Object
    Element
    Inline
    DrawingElement
    Shape
    Derived
    Canvas
    Picture
    TextBox
    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.

    • C#
    • VB.NET
    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
    System.ArgumentNullException

    layout is null.

    Properties

    AdjustValues

    Gets the shape's adjust values.

    • C#
    • VB.NET
    public IDictionary<string, double> AdjustValues { get; }
    Public ReadOnly Property AdjustValues As IDictionary(Of String, Double)
    Property Value
    System.Collections.Generic.IDictionary<System.String, System.Double>

    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
    ShapeType

    ElementType

    Gets the element type for Shape which is Shape.

    • C#
    • VB.NET
    public override ElementType ElementType { get; }
    Public Overrides ReadOnly Property ElementType As ElementType
    Property Value
    ElementType

    The Shape value.

    Overrides
    Element.ElementType

    Fill

    Gets the Brush that specifies how the shape's interior is filled.

    • C#
    • VB.NET
    public Brush Fill { get; }
    Public ReadOnly Property Fill As Brush
    Property Value
    Brush

    The Brush that specifies how the shape's interior is filled.

    Outline

    Gets the Pen that specifies the shape's outline.

    • C#
    • VB.NET
    public Pen Outline { get; }
    Public ReadOnly Property Outline As Pen
    Property Value
    Pen

    The Pen that specifies the shape's outline.

    ShapeType

    Gets the type of the shape.

    • C#
    • VB.NET
    public ShapeType ShapeType { get; }
    Public ReadOnly Property ShapeType As ShapeType
    Property Value
    ShapeType

    The type of the shape.

    Methods

    Clone(Boolean)

    Clones this Shape instance.

    • C#
    • VB.NET
    public Shape Clone(bool cloneDescendants)
    Public Function Clone(cloneDescendants As Boolean) As Shape
    Parameters
    cloneDescendants
    System.Boolean

    If set to true clone all descendants recursively; otherwise clone only current Shape.

    Returns
    Shape

    Cloned Shape.

    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.

    Inherited Properties

    CharacterFormat

    Gets or sets the character format.

    (Inherited from DrawingElement)

    Content

    Gets the content of the current Element.

    (Inherited from Element)

    Document

    Gets the owner document.

    (Inherited from Element)

    Hidden

    Gets or sets a value indicating whether this DrawingElement is hidden.

    Default value is false.

    (Inherited from DrawingElement)

    Layout

    Gets or sets the DrawingElement layout (position and size).

    (Inherited from DrawingElement)

    Metadata

    Gets the metadata (non-visual properties) of this DrawingElement instance.

    (Inherited from DrawingElement)

    Parent

    Gets the parent of this Element instance.

    (Inherited from Element)

    ParentCollection

    Gets the InlineCollection that contains this Inline instance.

    (Inherited from Inline)

    Revision

    Gets or sets the revision information for the inline.

    (Inherited from Inline)

    Inherited Methods

    FormatDrawing()

    Formats this DrawingElement to its default size so it can be exported to PDF, XPS, image or be printed.

    (Inherited from DrawingElement)

    FormatDrawing(System.Double, System.Double, LengthUnit)

    Formats this DrawingElement to specified size so it can be exported to PDF, XPS, image or be printed.

    (Inherited from DrawingElement)

    FormatDrawing(System.Double, System.Double, LengthUnit, PaginatorOptions)

    Formats this DrawingElement to specified size so it can be exported to PDF, XPS, image or be printed.

    (Inherited from DrawingElement)

    FormatDrawing(PaginatorOptions)

    Formats this DrawingElement to its default size so it can be exported to PDF, XPS, image or be printed.

    (Inherited from DrawingElement)

    GetChildElements(System.Boolean)

    Gets the child elements.

    (Inherited from Element)

    GetChildElements(System.Boolean, ElementType[])

    Gets the child elements filtered by ElementType.

    (Inherited from Element)

    GetParentElements()

    Gets the parent elements.

    (Inherited from Element)

    GetParentElements(ElementType[])

    Gets the parent elements.

    (Inherited from Element)

    Examples

    Shapes example
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.