Dim caption As String = "Example: DrawPie"
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 pies.
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 pies
(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 pies
(gdpicturePDF.DrawPie(8, 6, 4, -45, 45, False, True) = GdPictureStatus.OK) AndAlso 'the first pie
(gdpicturePDF.DrawPie(5, 12, 4, -45, 45, True, False) = GdPictureStatus.OK) AndAlso 'the second pie
(gdpicturePDF.DrawPie(15, 12, 4, -45, 45, True, True) = GdPictureStatus.OK) AndAlso 'the third pie
(gdpicturePDF.SetFillColor(0, 0, 0) = GdPictureStatus.OK) AndAlso 'the color used to draw text + the code below is used to describe all pies drawn above
(gdpicturePDF.DrawText(fontName, 8, 6, "1") = GdPictureStatus.OK) AndAlso 'the center of the circle of the first pie
(gdpicturePDF.DrawText(fontName, 5, 12, "2") = GdPictureStatus.OK) AndAlso 'the center of the circle of the second pie
(gdpicturePDF.DrawText(fontName, 15, 12, "3") = GdPictureStatus.OK) AndAlso 'the center of the circle of the third pie
(gdpicturePDF.DrawText(fontName, 7, 4, "only stroke") = GdPictureStatus.OK) AndAlso 'used attributes
(gdpicturePDF.DrawText(fontName, 4, 10, "only fill") = GdPictureStatus.OK) AndAlso
(gdpicturePDF.DrawText(fontName, 14, 10, "fill & stroke") = GdPictureStatus.OK) Then
status = gdpicturePDF.SaveToFile("test_DrawPie.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: DrawPie";
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 pies.
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 pies
(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 pies
(gdpicturePDF.DrawPie(8, 6, 4, -45, 45, false, true) == GdPictureStatus.OK) && //the first pie
(gdpicturePDF.DrawPie(5, 12, 4, -45, 45, true, false) == GdPictureStatus.OK) && //the second pie
(gdpicturePDF.DrawPie(15, 12, 4, -45, 45, true, true) == GdPictureStatus.OK) && //the third pie
//the code below is used to describe all pies drawn above
(gdpicturePDF.SetFillColor(0, 0, 0) == GdPictureStatus.OK) && //the color used to draw text
(gdpicturePDF.DrawText(fontName, 8, 6, "1") == GdPictureStatus.OK) && //the center of the circle of the first pie
(gdpicturePDF.DrawText(fontName, 5, 12, "2") == GdPictureStatus.OK) && //the center of the circle of the second pie
(gdpicturePDF.DrawText(fontName, 15, 12, "3") == GdPictureStatus.OK) && //the center of the circle of the third pie
(gdpicturePDF.DrawText(fontName, 7, 4, "only stroke") == GdPictureStatus.OK) && //used attributes
(gdpicturePDF.DrawText(fontName, 4, 10, "only fill") == GdPictureStatus.OK) &&
(gdpicturePDF.DrawText(fontName, 14, 10, "fill & stroke") == GdPictureStatus.OK))
{
status = gdpicturePDF.SaveToFile("test_DrawPie.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();