Class PdfBrush
Provides objects used to fill the interiors of graphical shapes such as rectangles, ellipses, pies, polygons, and paths.
Implements
System.ICloneable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public abstract class PdfBrush : ICloneable
Examples
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF brush.
PdfBrush brush = new PdfSolidBrush(Color.Red);
//Draw rectangle.
graphics.DrawRectangle(brush, new RectangleF(0, 0, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF brush.
Dim brush As PdfBrush = New PdfSolidBrush(Color.Red)
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)
Constructors
PdfBrush()
Declaration
protected PdfBrush()
Methods
Clone()
Creates a new copy of a brush.
Declaration
public abstract PdfBrush Clone()
Returns
Type | Description |
---|---|
PdfBrush | A new instance of the Brush class. |
Examples
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF brush.
PdfBrush brush = new PdfSolidBrush(Color.Red);
//Draw rectangle.
graphics.DrawRectangle(brush, new RectangleF(0, 0, 200, 100));
//Clone the existing brush.
PdfBrush brush1 = brush.Clone();
(brush1 as PdfSolidBrush).Color = Color.Green;
//Draw circle.
graphics.DrawEllipse(brush1, new RectangleF(300, 0, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF brush.
Dim brush As PdfBrush = New PdfSolidBrush(Color.Red)
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Clone the existing brush.
Dim brush1 As PdfBrush = brush.Clone()
TryCast(brush1, PdfSolidBrush).Color = Color.Green
'Draw circle.
graphics.DrawEllipse(brush1, New RectangleF(300, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)
Explicit Interface Implementations
ICloneable.Clone()
Creates a new object that is a copy of the current instance.
Declaration
object ICloneable.Clone()
Returns
Type | Description |
---|---|
System.Object | A new object that is a copy of this instance. |
Implements
System.ICloneable