Class PdfHatchBrush
Represents a brush that uses a hatch pattern to fill the interiors of graphical shapes in a PDF document.
Implements
Inherited Members
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfHatchBrush : PdfTilingBrush, ICloneable, IPdfWrapper
Remarks
The PdfHatchBrush class allows you to create a variety of hatch patterns, which are combinations of lines, dots, and other shapes, to fill the interiors of graphical shapes.
Examples
// Create a new PDF document.
PdfDocument doc = new PdfDocument();
// Add a page to the document.
PdfPage page = doc.Pages.Add();
// Create a PDF graphics for the page.
PdfGraphics graphics = page.Graphics;
//Define colors for the hatch brush.
Color systemForeColor = Color.FromArgb(255, 255, 255, 0);
Color systemBackColor = Color.FromArgb(255, 78, 167, 46);
// Create a new PDF hatch brush with a pattern and colors.
PdfHatchBrush hatchBrush = new PdfHatchBrush(PdfHatchStyle.Cross, new PdfColor(systemForeColor), new PdfColor(systemBackColor));
// Draw a rectangle using the hatch brush.
graphics.DrawRectangle(hatchBrush, new RectangleF(0, 0, 200, 100));
// Save the document.
doc.Save("HatchBrushOutput.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
' Define colors for the hatch brush.
Dim systemForeColor As Color = Color.FromArgb(255, 255, 255, 0)
' Define colors for the hatch brush.
Dim systemBackColor As Color = Color.FromArgb(255, 255, 255, 0)
' Create a new PDF hatch brush with a pattern and colors.
Dim hatchBrush As New PdfHatchBrush(PdfHatchStyle.Cross, New PdfColor(systemForeColor), New PdfColor(systemBackColor))
' Draw a rectangle using the hatch brush.
graphics.DrawRectangle(hatchBrush, New RectangleF(0, 0, 200, 100))
' Save the document.
doc.Save("HatchBrushOutput.pdf")
' Close the document.
doc.Close(True)
Constructors
PdfHatchBrush(PdfHatchStyle, PdfColor, PdfColor)
Initializes a new instance of the PdfHatchBrush class with the specified hatch style, foreground color, and background color.
Declaration
public PdfHatchBrush(PdfHatchStyle hatchStyle, PdfColor foreColor, PdfColor backColor)
Parameters
Type | Name | Description |
---|---|---|
PdfHatchStyle | hatchStyle | A PdfHatchStyle enumeration value that specifies the style of the hatch. |
PdfColor | foreColor | A Color structure that represents the color of lines in the hatch pattern. |
PdfColor | backColor | A Color structure that represents the color of spaces between the hatch lines. |
Examples
// Create a new PDF document.
PdfDocument doc = new PdfDocument();
// Add a page to the document.
PdfPage page = doc.Pages.Add();
// Create a PDF graphics for the page.
PdfGraphics graphics = page.Graphics;
//Define colors for the hatch brush.
Color systemForeColor = Color.FromArgb(255, 255, 255, 0);
Color systemBackColor = Color.FromArgb(255, 78, 167, 46);
// Create a new PDF hatch brush with a pattern and colors.
PdfHatchBrush hatchBrush = new PdfHatchBrush(PdfHatchStyle.Cross, new PdfColor(systemForeColor), new PdfColor(systemBackColor));
// Draw a rectangle using the hatch brush.
graphics.DrawRectangle(hatchBrush, new RectangleF(0, 0, 200, 100));
// Save the document.
doc.Save("HatchBrushOutput.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
' Define colors for the hatch brush.
Dim systemForeColor As Color = Color.FromArgb(255, 255, 255, 0)
' Define colors for the hatch brush.
Dim systemBackColor As Color = Color.FromArgb(255, 255, 255, 0)
' Create a new PDF hatch brush with a pattern and colors.
Dim hatchBrush As New PdfHatchBrush(PdfHatchStyle.Cross, New PdfColor(systemForeColor), New PdfColor(systemBackColor))
' Draw a rectangle using the hatch brush.
graphics.DrawRectangle(hatchBrush, New RectangleF(0, 0, 200, 100))
' Save the document.
doc.Save("HatchBrushOutput.pdf")
' Close the document.
doc.Close(True)