cete.dynamicpdf.pageelements.rectangle
Rectangle
- Namespace: ceTe.DynamicPDF.PageElements
- Assemblies: ceTe.DynamicPDF.40.dll
Represents a rectangle page element.
public class Rectangle : RotatingPageElement, IArea, ICoordinate, ISerializable
Public Class Rectangle
Inherits RotatingPageElement
Implements IArea, ICoordinate, ISerializable
Inheritance: Object → PageElement → TaggablePageElement → RotatingPageElement → Rectangle
Implements: IArea, ICoordinate, ISerializable
Licensing
This class is a DynamicPDF Generator Community Edition feature.
Examples
The following example will display a custom rectangle on the page.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a Page and add it to the document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
' Create a rectangle
Dim MyRectangle As Rectangle = New Rectangle(50, 50, 200, _ 200, Grayscale.Black, RgbColor.Gray, 4, LineStyle.Solid)
' Change the corner radius property
MyRectangle.CornerRadius = 10
' Add the rectangle to the page
MyPage.Elements.Add(MyRectangle)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
class MyClass
{
static void Main()
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add( page );
// Create a rectangle
Rectangle rectangle = new Rectangle( 50, 50, 200, 200, Grayscale.Black, RgbColor.Gray, 4, LineStyle.Solid );
// Change the corner radius property
rectangle.CornerRadius = 10;
// Add the rectangle to the page
page.Elements.Add( rectangle );
// Save the PDF
document.Draw( @"C:\MyDocument.pdf" );
}
}
Remarks
This class can be used to place rectangles of any size or color on a page.
Constructors
Rectangle(Single, Single, Single, Single)
Initializes a new instance of the Rectangle class.
public Rectangle(float x, float y, float width, float height)
Public Sub New (x As Single, y As Single, width As Single, height As Single)
Parameters
- x: Single
X coordinate of the rectangle.
- y: Single
Y coordinate of the rectangle.
- width: Single
Width of the rectangle.
- height: Single
Height of the rectangle.
Rectangle(Single, Single, Single, Single, Color)
Initializes a new instance of the Rectangle class.
public Rectangle(float x, float y, float width, float height, Color borderColor)
Public Sub New (x As Single, y As Single, width As Single, height As Single, borderColor As Color)
Parameters
- x: Single
X coordinate of the rectangle.
- y: Single
Y coordinate of the rectangle.
- width: Single
Width of the rectangle.
- height: Single
Height of the rectangle.
- borderColor: Color
Color of the border of the rectangle.
Rectangle(Single, Single, Single, Single, Color, Color)
Initializes a new instance of the Rectangle class.
public Rectangle(float x, float y, float width, float height, Color borderColor, Color fillColor)
Public Sub New (x As Single, y As Single, width As Single, height As Single, borderColor As Color, fillColor As Color)
Parameters
- x: Single
X coordinate of the rectangle.
- y: Single
Y coordinate of the rectangle.
- width: Single
Width of the rectangle.
- height: Single
Height of the rectangle.
- borderColor: Color
Color of the border of the rectangle.
- fillColor: Color
Color of the fill of the rectangle.
Rectangle(Single, Single, Single, Single, Color, Color, Single)
Initializes a new instance of the Rectangle class.
public Rectangle(float x, float y, float width, float height, Color borderColor, Color fillColor, float borderWidth)
Public Sub New (x As Single, y As Single, width As Single, height As Single, borderColor As Color, fillColor As Color, borderWidth As Single)
Parameters
- x: Single
X coordinate of the rectangle.
- y: Single
Y coordinate of the rectangle.
- width: Single
Width of the rectangle.
- height: Single
Height of the rectangle.
- borderColor: Color
Color of the border of the rectangle.
- fillColor: Color
Color of the fill of the rectangle.
- borderWidth: Single
Width of the border of the rectangle.
Rectangle(Single, Single, Single, Single, Color, Color, Single, LineStyle)
Initializes a new instance of the Rectangle class.
public Rectangle(float x, float y, float width, float height, Color borderColor, Color fillColor, float borderWidth, LineStyle borderStyle)
Public Sub New (x As Single, y As Single, width As Single, height As Single, borderColor As Color, fillColor As Color, borderWidth As Single, borderStyle As LineStyle)
Parameters
- x: Single
X coordinate of the rectangle.
- y: Single
Y coordinate of the rectangle.
- width: Single
Width of the rectangle.
- height: Single
Height of the rectangle.
- borderColor: Color
Color of the border of the rectangle.
- fillColor: Color
Color of the fill of the rectangle.
- borderWidth: Single
Width of the border of the rectangle.
- borderStyle: LineStyle
Style of the border of the rectangle.
Rectangle(Single, Single, Single, Single, Color, Single)
Initializes a new instance of the Rectangle class.
public Rectangle(float x, float y, float width, float height, Color borderColor, float borderWidth)
Public Sub New (x As Single, y As Single, width As Single, height As Single, borderColor As Color, borderWidth As Single)
Parameters
- x: Single
X coordinate of the rectangle.
- y: Single
Y coordinate of the rectangle.
- width: Single
Width of the rectangle.
- height: Single
Height of the rectangle.
- borderColor: Color
Color of the border of the rectangle.
- borderWidth: Single
Width of the border of the rectangle.
Rectangle(Single, Single, Single, Single, Color, Single, LineStyle)
Initializes a new instance of the Rectangle class.
public Rectangle(float x, float y, float width, float height, Color borderColor, float borderWidth, LineStyle borderStyle)
Public Sub New (x As Single, y As Single, width As Single, height As Single, borderColor As Color, borderWidth As Single, borderStyle As LineStyle)
Parameters
- x: Single
X coordinate of the rectangle.
- y: Single
Y coordinate of the rectangle.
- width: Single
Width of the rectangle.
- height: Single
Height of the rectangle.
- borderColor: Color
Color of the border of the rectangle.
- borderWidth: Single
Width of the border of the rectangle.
- borderStyle: LineStyle
Style of the border of the rectangle.
Rectangle(Single, Single, Single, Single, Single)
Initializes a new instance of the Rectangle class.
public Rectangle(float x, float y, float width, float height, float borderWidth)
Public Sub New (x As Single, y As Single, width As Single, height As Single, borderWidth As Single)
Parameters
- x: Single
X coordinate of the rectangle.
- y: Single
Y coordinate of the rectangle.
- width: Single
Width of the rectangle.
- height: Single
Height of the rectangle.
- borderWidth: Single
Width of the border of the rectangle.
Rectangle(Single, Single, Single, Single, Single, Color)
Initializes a new instance of the Rectangle class.
public Rectangle(float x, float y, float width, float height, float borderWidth, Color fillColor)
Public Sub New (x As Single, y As Single, width As Single, height As Single, borderWidth As Single, fillColor As Color)
Parameters
- x: Single
X coordinate of the rectangle.
- y: Single
Y coordinate of the rectangle.
- width: Single
Width of the rectangle.
- height: Single
Height of the rectangle.
- borderWidth: Single
Width of the border of the rectangle.
- fillColor: Color
Color of the fill of the rectangle.
Rectangle(Single, Single, Single, Single, Single, LineStyle)
Initializes a new instance of the Rectangle class.
public Rectangle(float x, float y, float width, float height, float borderWidth, LineStyle borderStyle)
Public Sub New (x As Single, y As Single, width As Single, height As Single, borderWidth As Single, borderStyle As LineStyle)
Parameters
- x: Single
X coordinate of the rectangle.
- y: Single
Y coordinate of the rectangle.
- width: Single
Width of the rectangle.
- height: Single
Height of the rectangle.
- borderWidth: Single
Width of the border of the rectangle.
- borderStyle: LineStyle
Style of the border of the rectangle.
Properties
Angle
Gets or sets the heights of the angle element. (Inherited from RotatingPageElement)
public float Angle { get; set; }
Public Property Angle As Single
Property Value
BorderColor
Gets or sets the Color object to use for the border of the rectangle.
public Color BorderColor { get; set; }
Public Property BorderColor As Color
Property Value
BorderStyle
Gets or sets the LineStyle object used to specify the border style of the rectangle.
public LineStyle BorderStyle { get; set; }
Public Property BorderStyle As LineStyle
Property Value
BorderWidth
Gets or sets the border width of the rectangle.
public float BorderWidth { get; set; }
Public Property BorderWidth As Single
Property Value
Remarks
To force the borders not to appear set the border width to any value 0 or less.
CornerRadius
Gets or sets the corner radius of the rectangle.
public float CornerRadius { get; set; }
Public Property CornerRadius As Single
Property Value
FillColor
Gets or sets the Color object to use for the fill of the rectangle.
public Color FillColor { get; set; }
Public Property FillColor As Color
Property Value
Remarks
To force no color to appear in the rectangle (only borders) set the fill color to null (Nothing in Visual Basic).
Height
Gets or sets the heights of the page element. (Inherited from RotatingPageElement)
public float Height { get; set; }
Public Property Height As Single
Property Value
ID
Gets or sets the ID of the page element. (Inherited from PageElement)
public string ID { get; set; }
Public Property ID As String
Property Value
Tag
Gets or sets the tag of the taggable element. (Inherited from TaggablePageElement)
public Tag Tag { get; set; }
Public Property Tag As Tag
Property Value
Licensing
This property is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
TagOrder
Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement)
public int TagOrder { get; set; }
Public Property TagOrder As Int32
Property Value
Width
Gets or sets the width of the rectangle.
public float Width { get; set; }
Public Property Width As Single
Property Value
X
Gets or sets the X coordinate of the page element. (Inherited from RotatingPageElement)
public float X { get; set; }
Public Property X As Single
Property Value
Y
Gets or sets the Y coordinate of the page element. (Inherited from RotatingPageElement)
public float Y { get; set; }
Public Property Y As Single
Property Value
Methods
Draw(PageWriter)
Draws the page element to the given PageWriter object. (Inherited from RotatingPageElement)
public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)
Parameters
- writer: PageWriter
PageWriter object to receive the page element's output.
Equals(Object)
Determines whether the specified Object is equal to the current Object . (Inherited from Object)
public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean
Parameters
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
GetHashCode()
Serves as a hash function for a particular type. (Inherited from Object)
public int GetHashCode()
Function GetHashCode() As Integer
Returns
A hash code for the current Object .
GetType()
Gets the Type of the current instance. (Inherited from Object)
public Type GetType()
Function GetType() As Type
Returns
The Type instance that represents the exact runtime type of the current instance.
ToString()
Returns a String that represents the current Object . (Inherited from Object)
public string ToString()
Function ToString() As String
Returns
A String that represents the current Object .