officefileapi-devexpress-dot-pdf-dot-pdfgraphics-dot-drawbezier-x28-devexpress-dot-drawing-dot-dxpen-system-dot-drawing-dot-pointf-system-dot-drawing-dot-pointf-system-dot-drawing-dot-pointf-system-dot-drawing-dot-pointf-x29.md
Draws a Bezier curve specified by four points (in the world coordinate system).
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Drawing.dll
NuGet Package : DevExpress.Pdf.Drawing
public void DrawBezier(
DXPen pen,
PointF pt1,
PointF pt2,
PointF pt3,
PointF pt4
)
Public Sub DrawBezier(
pen As DXPen,
pt1 As PointF,
pt2 As PointF,
pt3 As PointF,
pt4 As PointF
)
| Name | Type | Description |
|---|---|---|
| pen | DXPen |
A DXPen object that specifies the color, width, and style of the curve.
| | pt1 | PointF |
A Point structure that specifies the start point of the curve.
| | pt2 | PointF |
A Point structure that specifies the first control point of the curve.
| | pt3 | PointF |
A Point structure that specifies the second control point of the curve.
| | pt4 | PointF |
A Point structure that specifies the end point of the curve.
|
The Bezier curve starts from the first point and ends at the fourth point. The second and third points are control points that specify the shape of the curve. To draw a Bezier curve, pass the pen parameter and point parameters ( pt1 , pt2 , pt3 , pt4 ) to the DrawBezier method.
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.
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())
{
// Draw a Bezier curve.
using (var pen = new DXPen(Color.Red, 5))
graphics.DrawBezier(pen, new PointF(100, 750),
new PointF(170, 100), new PointF(300, 500),
new PointF(400, 100));
// 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()
' Draw a Bezier curve.
Using pen As New DXPen(Color.Red, 5)
graphics.DrawBezier(pen, New PointF(100, 750),
New PointF(170, 100), New PointF(300, 500),
New PointF(400, 100))
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