officefileapi-devexpress-dot-pdf-dot-pdfgraphics-dot-drawlines-x28-devexpress-dot-drawing-dot-dxpen-system-dot-drawing-dot-pointf-x29.md
Draws a series of lines that connect points from the specified array.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Drawing.dll
NuGet Package : DevExpress.Pdf.Drawing
public void DrawLines(
DXPen pen,
PointF[] points
)
Public Sub DrawLines(
pen As DXPen,
points As PointF()
)
| Name | Type | Description |
|---|---|---|
| pen | DXPen |
A DXPen object that specifies the color, width, and style of the lines.
| | points | PointF[] |
An array of PointF structures that specifies points to connect (in world coordinate system).
|
The first two points of the points array specify the first line. Each next line connects the previous line’s end point and the next array point. Pass the points and pen parameters to the DrawLines method to draw a series of lines.
To draw a shape on the PDF page, use one of the following methods:
PdfGraphics.AddToPageForeground, PdfGraphics.AddToPageBackgroundThese methods allow you to draw content on an existing page.PdfDocumentProcessor.RenderNewPageDraws content on a new page.
The following code snippet draws a series of lines by seven points.
using DevExpress.Pdf;
using System.Drawing;
using DevExpress.Drawing;
//...
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
processor.CreateEmptyDocument();
PdfPage page = processor.AddNewPage(PdfPaperSize.A4);
using (PdfGraphics graphics = processor.CreateGraphicsWorldSystem())
{
// Create a point array.
PointF[] points = new PointF[]
{
new PointF(100, 100),
new PointF(200, 10),
new PointF(450, 150),
new PointF(500, 400),
new PointF(400, 550),
new PointF(550, 650),
new PointF(500, 700)
};
// Draw a series of lines.
using (var pen = new DXPen(Color.Red, 5))
graphics.DrawLines(pen, points);
// Add graphics content to the document page.
graphics.AddToPageForeground(page);
}
processor.SaveDocument("out2.pdf");
}
Process.Start("out.pdf");
Imports DevExpress.Pdf
Imports System.Drawing
Imports DevExpress.Drawing
'...
Using processor As New PdfDocumentProcessor()
processor.CreateEmptyDocument()
Dim page As PdfPage = processor.AddNewPage(PdfPaperSize.A4)
Using graphics As PdfGraphics = processor.CreateGraphicsWorldSystem()
' Create a point array.
Dim points() As PointF = {
New PointF(100, 100),
New PointF(200, 10),
New PointF(450, 150),
New PointF(500, 400),
New PointF(400, 550),
New PointF(550, 650),
New PointF(500, 700)
}
' Draw a series of lines.
Using pen As New DXPen(Color.Red, 5)
graphics.DrawLines(pen, points)
End Using
' Add graphics content to the document page.
graphics.AddToPageForeground(page)
End Using
processor.SaveDocument("out2.pdf")
End Using
Process.Start("out.pdf")
See Also