Class Canvas
Represents the canvas that contains shapes.
Implements
Inherited Members
Namespace: Syncfusion.DLS
Assembly: Syncfusion.DLS.Base.dll
Syntax
public class Canvas : ParagraphItem, IXDLSSerializable, ICanvas, IParagraphItem, IEntityBase, ISplitLeafWidget, ILeafWidget, IWidget
Remarks
Supported by Essential PDF only.
Constructors
Canvas(Document)
Initializing constructor
Declaration
public Canvas(Document doc)
Parameters
| Type | Name | Description |
|---|---|---|
| Document | doc |
Properties
BorderColor
Gets / sets border color
Declaration
public Color BorderColor { get; set; }
Property Value
| Type |
|---|
| System.Drawing.Color |
Height
Gets / sets canvas height
Declaration
public float Height { get; set; }
Property Value
| Type |
|---|
| System.Single |
Shapes
Gets canvas shapes collection.
Declaration
public ShapeCollection Shapes { get; }
Property Value
| Type |
|---|
| ShapeCollection |
Size
Gets / sets size of the canvas.
Declaration
public SizeF Size { get; set; }
Property Value
| Type |
|---|
| System.Drawing.SizeF |
Width
Gets / sets canvas width
Declaration
public float Width { get; set; }
Property Value
| Type |
|---|
| System.Single |
Methods
AddArc()
Creates Arc shape and adds it to collection.
Declaration
public ArcShape AddArc()
Returns
| Type | Description |
|---|---|
| ArcShape | Created Arc shape. |
Remarks
Coordinates of this shape needs to be set to correctly display this shape on the canvas.
AddBezier()
Creates Bezier curve shape and adds it to collection.
Declaration
public BezierShape AddBezier()
Returns
| Type | Description |
|---|---|
| BezierShape | Created Bezier curve shape. |
Remarks
Coordinates of this shape needs to be set to correctly display this shape on the canvas.
AddEllipse()
Creates Ellipse shape and adds it to collection.
Declaration
public EllipseShape AddEllipse()
Returns
| Type | Description |
|---|---|
| EllipseShape | Created Ellipse shape. |
Remarks
Coordinates of this shape needs to be set to correctly display this shape on the canvas.
AddImage(Image)
Creates Image shape and adds it to collection.
Declaration
public ImageShape AddImage(Image image)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Image | image | Image object. |
Returns
| Type | Description |
|---|---|
| ImageShape | Created Image shape. |
Remarks
Coordinates of this shape needs to be set to correctly display this shape on the canvas.
AddLine()
Creates Line shape and adds it to collection.
Declaration
public LineShape AddLine()
Returns
| Type | Description |
|---|---|
| LineShape | Created Line shape. |
Remarks
Coordinates of this shape needs to be set to correctly display this shape on the canvas.
AddPath()
Creates Path shape and adds it to collection.
Declaration
public PathShape AddPath()
Returns
| Type | Description |
|---|---|
| PathShape | Created Path shape. |
Remarks
Coordinates of this shape needs to be set to correctly display this shape on the canvas.
AddPie()
Creates Pie shape and adds it to collection.
Declaration
public PieShape AddPie()
Returns
| Type | Description |
|---|---|
| PieShape | Created Pie shape. |
Remarks
Coordinates of this shape needs to be set to correctly display this shape on the canvas.
AddPolygon()
Creates Polygon shape and adds it to collection.
Declaration
public PolygonShape AddPolygon()
Returns
| Type | Description |
|---|---|
| PolygonShape | Created Polygon shape. |
Remarks
Coordinates of this shape needs to be set to correctly display this shape on the canvas.
AddRectangle()
Creates Rectangle shape and adds it to collection.
Declaration
public RectangleShape AddRectangle()
Returns
| Type | Description |
|---|---|
| RectangleShape | Created Rectangle shape. |
Remarks
Coordinates of this shape needs to be set to correctly display this shape on the canvas.
AddShape(ShapeType)
Adds a new shape to the canvas.
Declaration
public Shape AddShape(ShapeType shapeType)
Parameters
| Type | Name | Description |
|---|---|---|
| ShapeType | shapeType |
Returns
| Type |
|---|
| Shape |
AddText(String)
Creates Text shape and adds it to collection.
Declaration
public TextShape AddText(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | Text data of the shape. |
Returns
| Type | Description |
|---|---|
| TextShape | Created Text shape. |
Remarks
Coordinates of this shape needs to be set to correctly display this shape on the canvas.
Clone(IParagraph)
Clones itself.
Declaration
public override IParagraphItem Clone(IParagraph paragraph)
Parameters
| Type | Name | Description |
|---|---|---|
| IParagraph | paragraph |
Returns
| Type |
|---|
| IParagraphItem |
Overrides
CreateLayoutInfo()
Declaration
protected override void CreateLayoutInfo()
Overrides
Draw(CustomGraphics, LayoutedWidget)
Declaration
public virtual void Draw(CustomGraphics cg, LayoutedWidget ltWidget)
Parameters
| Type | Name | Description |
|---|---|---|
| CustomGraphics | cg | |
| LayoutedWidget | ltWidget |
InitXDLSHolder()
Declaration
protected override void InitXDLSHolder()
Overrides
Measure(CustomGraphics)
Declaration
public SizeF Measure(CustomGraphics graphics)
Parameters
| Type | Name | Description |
|---|---|---|
| CustomGraphics | graphics |
Returns
| Type |
|---|
| System.Drawing.SizeF |
ReadXmlAttributes(IXDLSAttributeReader)
Overloaded. Reads XML attributes.
Declaration
protected override void ReadXmlAttributes(IXDLSAttributeReader reader)
Parameters
| Type | Name | Description |
|---|---|---|
| IXDLSAttributeReader | reader | Reader object. |
Overrides
SplitByOffset(CustomGraphics, SizeF)
Declaration
public ISplitLeafWidget[] SplitByOffset(CustomGraphics graphics, SizeF offset)
Parameters
| Type | Name | Description |
|---|---|---|
| CustomGraphics | graphics | |
| System.Drawing.SizeF | offset |
Returns
| Type |
|---|
| ISplitLeafWidget[] |
WriteXmlAttributes(IXDLSAttributeWriter)
Declaration
protected override void WriteXmlAttributes(IXDLSAttributeWriter writer)
Parameters
| Type | Name | Description |
|---|---|---|
| IXDLSAttributeWriter | writer |