Dim caption As String = "Example: DrawArc"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.NewPDF()
If status = GdPictureStatus.OK Then
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
'//This is the font only used to describe the drawn arcs.
Dim fontName As String = gdpicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontTimesBold)
If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
If (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.SetLineColor(255, 140, 0) = GdPictureStatus.OK) AndAlso 'the color used to stroke the arcs
(gdpicturePDF.SetLineWidth(0.1F) = GdPictureStatus.OK) AndAlso 'the line width used to stroke
(gdpicturePDF.SetFillColor(153, 50, 204) = GdPictureStatus.OK) AndAlso 'the color used to fill the arcs
(gdpicturePDF.DrawArc(5, 6, 4, -45, 45, False, False, True) = GdPictureStatus.OK) AndAlso 'the first arc
(gdpicturePDF.DrawArc(15, 6, 4, -45, 45, False, True, True) = GdPictureStatus.OK) AndAlso 'the second arc
(gdpicturePDF.DrawArc(5, 12, 4, -45, 45, True, False, True) = GdPictureStatus.OK) AndAlso 'the third arc
(gdpicturePDF.DrawArc(15, 12, 4, -45, 45, True, True, True) = GdPictureStatus.OK) AndAlso 'the fourth arc
(gdpicturePDF.SetFillColor(0, 0, 0) = GdPictureStatus.OK) AndAlso 'the color used to draw text + the code below is used to describe all arcs drawn above
(gdpicturePDF.DrawText(fontName, 5, 6, "1") = GdPictureStatus.OK) AndAlso 'starting point of the first arc
(gdpicturePDF.DrawText(fontName, 15, 6, "2") = GdPictureStatus.OK) AndAlso 'starting point of the second arc
(gdpicturePDF.DrawText(fontName, 5, 12, "3") = GdPictureStatus.OK) AndAlso 'starting point of the third arc
(gdpicturePDF.DrawText(fontName, 15, 12, "4") = GdPictureStatus.OK) AndAlso 'starting point of the four arc
(gdpicturePDF.DrawText(fontName, 3, 5, "only stroke") = GdPictureStatus.OK) AndAlso 'used attributes
(gdpicturePDF.DrawText(fontName, 13, 5, "fill & stroke") = GdPictureStatus.OK) AndAlso
(gdpicturePDF.DrawText(fontName, 3, 11, "close, not fill, but stroke") = GdPictureStatus.OK) AndAlso
(gdpicturePDF.DrawText(fontName, 13, 11, "close & fill & stroke") = GdPictureStatus.OK) Then
status = gdpicturePDF.SaveToFile("test_DrawArc.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
Else
MessageBox.Show("The AddStandardFont() method has failed with the status: " + status.ToString(), caption)
End If
Else
MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: DrawArc";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.NewPDF();
if (status == GdPictureStatus.OK)
{
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter);
//This is the font only used to describe the drawn arcs.
string fontName = gdpicturePDF.AddStandardFont(PdfStandardFont.PdfStandardFontTimesBold);
if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
{
if ((gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK) &&
(gdpicturePDF.SetLineColor(255, 140, 0) == GdPictureStatus.OK) && //the color used to stroke the arcs
(gdpicturePDF.SetLineWidth(0.1f) == GdPictureStatus.OK) && //the line width used to stroke
(gdpicturePDF.SetFillColor(153, 50, 204) == GdPictureStatus.OK) && //the color used to fill the arcs
(gdpicturePDF.DrawArc(5, 6, 4, -45, 45, false, false, true) == GdPictureStatus.OK) && //the first arc
(gdpicturePDF.DrawArc(15, 6, 4, -45, 45, false, true, true) == GdPictureStatus.OK) && //the second arc
(gdpicturePDF.DrawArc(5, 12, 4, -45, 45, true, false, true) == GdPictureStatus.OK) && //the third arc
(gdpicturePDF.DrawArc(15, 12, 4, -45, 45, true, true, true) == GdPictureStatus.OK) && //the fourth arc
//the code below is used to describe all arcs drawn above
(gdpicturePDF.SetFillColor(0, 0, 0) == GdPictureStatus.OK) && //the color used to draw text
(gdpicturePDF.DrawText(fontName, 5, 6, "1") == GdPictureStatus.OK) && //starting point of the first arc
(gdpicturePDF.DrawText(fontName, 15, 6, "2") == GdPictureStatus.OK) && //starting point of the second arc
(gdpicturePDF.DrawText(fontName, 5, 12, "3") == GdPictureStatus.OK) && //starting point of the third arc
(gdpicturePDF.DrawText(fontName, 15, 12, "4") == GdPictureStatus.OK) && //starting point of the four arc
(gdpicturePDF.DrawText(fontName, 3, 5, "only stroke") == GdPictureStatus.OK) && //used attributes
(gdpicturePDF.DrawText(fontName, 13, 5, "fill & stroke") == GdPictureStatus.OK) &&
(gdpicturePDF.DrawText(fontName, 3, 11, "close, not fill, but stroke") == GdPictureStatus.OK) &&
(gdpicturePDF.DrawText(fontName, 13, 11, "close & fill & stroke") == GdPictureStatus.OK))
{
status = gdpicturePDF.SaveToFile("test_DrawArc.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);
}
else
MessageBox.Show("The AddStandardFont() method has failed with the status: " + status.ToString(), caption);
}
else
MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption);
gdpicturePDF.Dispose();