Canvas Class
Represents a Shape which serves as a container for Block elements which are outside page main content flow.
public sealed class Canvas : Shape, IContentElement
Public NotInheritable Class Canvas
Inherits Shape
Implements IContentElement
- Inheritance:
- System.ObjectCanvas
Implements
Remarks
Canvas is a content Element consisting of Block derived elements (Paragraphs and Tables).
Canvas's shape type (geometry) is represented by ShapeType enumeration. It can be retrieved from ShapeType property.
Canvas can be filled with a Brush and outlined with a Pen.
Canvas 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.
Constructors
Canvas(DocumentModel, Layout)
Initializes a new instance of empty Canvas with specified layout (position and size).
public Canvas(DocumentModel document, Layout layout)
Public Sub New(document As DocumentModel, layout As Layout)
Parameters
document
- DocumentModel
The owner document.
layout
- Layout
The canvas layout (position and size).
Exceptions
- System.ArgumentNullException
layout
is null.
Canvas(DocumentModel, Layout, DrawingElement[])
Initializes a new instance of the Canvas class.
public Canvas(DocumentModel document, Layout layout, params DrawingElement[] items)
Public Sub New(document As DocumentModel, layout As Layout, ParamArray items As DrawingElement())
Parameters
document
- DocumentModel
The owner document.
layout
- Layout
The canvas shape's layout (position and size).
items
- DrawingElement[]
The canvas shape content.
Exceptions
- System.ArgumentNullException
layout
is null.
Canvas(DocumentModel, Layout, IEnumerable<DrawingElement>)
Initializes a new instance of the Canvas class.
public Canvas(DocumentModel document, Layout layout, IEnumerable<DrawingElement> items)
Public Sub New(document As DocumentModel, layout As Layout, items As IEnumerable(Of DrawingElement))
Parameters
document
- DocumentModel
The owner document.
layout
- Layout
The canvas shape's layout (position and size).
items
- System.Collections.Generic.IEnumerable<DrawingElement>
The canvas shape content.
Exceptions
- System.ArgumentNullException
document
, layout
, or items
is null.
Properties
Drawings
Gets all the drawings contained in this canvas.
public IEnumerable<DrawingElement> Drawings { get; }
Public ReadOnly Property Drawings As IEnumerable(Of DrawingElement)
Property Value
- System.Collections.Generic.IEnumerable<DrawingElement>
All the drawings contained in this canvas.
ElementType
public override ElementType ElementType { get; }
Public Overrides ReadOnly Property ElementType As ElementType
Property Value
The Canvas value.
Overrides
Methods
Add(DrawingElement)
Adds a drawing to this canvas.
Parameters
drawing
- DrawingElement
The drawing which will be added to this canvas.
Clone(Boolean)
Clones this Canvas instance.
public Canvas Clone(bool cloneDescendants)
Public Function Clone(cloneDescendants As Boolean) As Canvas
Parameters
cloneDescendants
- System.Boolean
If set to true clone all descendants recursively; otherwise clone only current Canvas.
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.
Remove(DrawingElement)
Removes a drawing from this canvas.
Parameters
drawing
- DrawingElement
The drawing which will be removed from this canvas.
Remarks
Removing drawing will not change the position of the canvas.
Inherited Properties
AdjustValues | Gets the shape's adjust values. (Inherited from Shape) |
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) |
Fill | Gets the Brush that specifies how the shape's interior is filled. (Inherited from Shape) |
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) |
Outline | Gets the Pen that specifies the shape's outline. (Inherited from Shape) |
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) |
ShapeType | Gets the type of the shape. (Inherited from Shape) |
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) |