Dim caption As String = "Example: AddGraphicsToPath"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.NewPDF()
If status = GdPictureStatus.OK Then
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
Dim graphicsPath As New System.Drawing.Drawing2D.GraphicsPath()
Dim myPoints As Point() = {New Point(50, 50), New Point(100, 100), New Point(50, 100), New Point(50, 50)}
Dim myRect As New Rectangle(100, 100, 120, 120)
graphicsPath.AddLines(myPoints)
graphicsPath.AddRectangle(myRect)
graphicsPath.AddEllipse(200, 200, 100, 100)
graphicsPath.AddString("I Love GdPicture.NET", New FontFamily("Arial"), 0, 20, New Point(), New StringFormat())
If (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.SetLineWidth(2) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.SetLineColor(0, 0, 128) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.AddGraphicsToPath(graphicsPath) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.StrokePath() = GdPictureStatus.OK) Then
status = gdpicturePDF.SaveToFile("test_AddGraphicsToPath.pdf")
If status = GdPictureStatus.OK Then
MessageBox.Show("The example has been followed successfully and the file has been saved.", caption)
Else
MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The example has not been followed successfully." + vbCrLf + "The last known status is " + gdpicturePDF.GetStat().ToString(), caption)
End If
graphicsPath.Dispose()
Else
MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: AddGraphicsToPath";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.NewPDF();
if (status == GdPictureStatus.OK)
{
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
System.Drawing.Drawing2D.GraphicsPath graphicsPath = new System.Drawing.Drawing2D.GraphicsPath();
Point[] myPoints = { new Point(50, 50), new Point(100, 100), new Point(50, 100), new Point(50, 50) };
Rectangle myRect = new Rectangle(100, 100, 120, 120);
graphicsPath.AddLines(myPoints);
graphicsPath.AddRectangle(myRect);
graphicsPath.AddEllipse(200, 200, 100, 100);
graphicsPath.AddString("I Love GdPicture.NET", new FontFamily("Arial"), 0, 20, new Point(), new StringFormat());
if ((gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK) &&
(gdpicturePDF.SetLineWidth(2) == GdPictureStatus.OK) &&
(gdpicturePDF.SetLineColor(0, 0, 128) == GdPictureStatus.OK) &&
(gdpicturePDF.AddGraphicsToPath(graphicsPath) == GdPictureStatus.OK) &&
(gdpicturePDF.StrokePath() == GdPictureStatus.OK))
{
status = gdpicturePDF.SaveToFile("test_AddGraphicsToPath.pdf");
if (status == GdPictureStatus.OK)
MessageBox.Show("The example has been followed successfully and the file has been saved.", caption);
else
MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption);
}
else
{
MessageBox.Show("The example has not been followed successfully.\nThe last known status is " + gdpicturePDF.GetStat().ToString(), caption);
}
graphicsPath.Dispose();
}
else
MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption);
gdpicturePDF.Dispose();