Dim caption As String = "Example: DrawEllipse"
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.NewPDF() <> GdPictureStatus.OK Then
MessageBox.Show("The NewPDF() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
GoTo [error]
End If
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
If gdpicturePDF.NewPage(210, 297) <> GdPictureStatus.OK Then
MessageBox.Show("The NewPage() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
GoTo [error]
End If
If (gdpicturePDF.SetFillAlpha(180) <> GdPictureStatus.OK) OrElse
(gdpicturePDF.SetFillColor(255, 0, 0) <> GdPictureStatus.OK) OrElse
(gdpicturePDF.DrawEllipse(100, 150, 180, 60, True, False) <> GdPictureStatus.OK) Then
MessageBox.Show("Drawing the first ellipse has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
GoTo [error]
End If
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginBottomLeft)
If (gdpicturePDF.SetFillColor(0, 0, 255) <> GdPictureStatus.OK) OrElse
(gdpicturePDF.DrawEllipse(100, 150, 180, 60, True, False) <> GdPictureStatus.OK) Then
MessageBox.Show("Drawing the second ellipse has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
GoTo [error]
End If
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopRight)
If (gdpicturePDF.SetFillColor(138, 43, 226) <> GdPictureStatus.OK) OrElse
(gdpicturePDF.DrawEllipse(100, 150, 180, 60, True, False) <> GdPictureStatus.OK) Then
MessageBox.Show("Drawing the third ellipse has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
GoTo [error]
End If
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginBottomRight)
If (gdpicturePDF.SetFillColor(255, 228, 196) <> GdPictureStatus.OK) OrElse
(gdpicturePDF.DrawEllipse(100, 150, 180, 60, True, False) <> GdPictureStatus.OK) Then
MessageBox.Show("Drawing the fourth ellipse has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
GoTo [error]
End If
Dim status As GdPictureStatus = gdpicturePDF.SaveToFile("test_DrawEllipse2.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
[error]:
gdpicturePDF.Dispose()
string caption = "Example: DrawEllipse";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.NewPDF() != GdPictureStatus.OK)
{
MessageBox.Show("The NewPDF() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
goto error;
}
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter);
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
if (gdpicturePDF.NewPage(210, 297) != GdPictureStatus.OK)
{
MessageBox.Show("The NewPage() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
goto error;
}
if ((gdpicturePDF.SetFillAlpha(180) != GdPictureStatus.OK) ||
(gdpicturePDF.SetFillColor(255, 0, 0) != GdPictureStatus.OK) ||
(gdpicturePDF.DrawEllipse(100, 150, 180, 60, true, false) != GdPictureStatus.OK))
{
MessageBox.Show("Drawing the first ellipse has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
goto error;
}
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginBottomLeft);
if ((gdpicturePDF.SetFillColor(0, 0, 255) != GdPictureStatus.OK) ||
(gdpicturePDF.DrawEllipse(100, 150, 180, 60, true, false) != GdPictureStatus.OK))
{
MessageBox.Show("Drawing the second ellipse has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
goto error;
}
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopRight);
if ((gdpicturePDF.SetFillColor(138, 43, 226) != GdPictureStatus.OK) ||
(gdpicturePDF.DrawEllipse(100, 150, 180, 60, true, false) != GdPictureStatus.OK))
{
MessageBox.Show("Drawing the third ellipse has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
goto error;
}
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginBottomRight);
if ((gdpicturePDF.SetFillColor(255, 228, 196) != GdPictureStatus.OK) ||
(gdpicturePDF.DrawEllipse(100, 150, 180, 60, true, false) != GdPictureStatus.OK))
{
MessageBox.Show("Drawing the fourth ellipse has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
goto error;
}
GdPictureStatus status = gdpicturePDF.SaveToFile("test_DrawEllipse2.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);
error:
gdpicturePDF.Dispose();