Dim caption As String = "Example: DrawLine"
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.NewPDF()
If status = GdPictureStatus.OK Then
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
If (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.SetLineColor(255, 140, 0) = GdPictureStatus.OK) AndAlso 'The color used to draw the line.
(gdpicturePDF.SetLineWidth(0.5F) = GdPictureStatus.OK) AndAlso 'the line width
(gdpicturePDF.DrawLine(2, 2, 18, 2) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.SetLineWidth(0.3F) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.DrawLine(2, 4, 18, 4) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.SetLineColor(210, 105, 30) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.SetLineWidth(0.2F) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.SetLineDash(2, 1) = GdPictureStatus.OK) AndAlso 'drawing a dash line
(gdpicturePDF.DrawLine(2, 6, 18, 6) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.DrawLine(2, 10, 18, 10) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.SetLineNoDash() = GdPictureStatus.OK) AndAlso
(gdpicturePDF.DrawLine(18, 6, 18, 10) = GdPictureStatus.OK) AndAlso
(gdpicturePDF.DrawLine(2, 6, 2, 10) = GdPictureStatus.OK) Then
status = gdpicturePDF.SaveToFile("test_DrawLine.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 NewPDF() method has failed with the status: " + status.ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: DrawLine";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.NewPDF();
if (status == GdPictureStatus.OK)
{
gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter);
if ((gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK) &&
(gdpicturePDF.SetLineColor(255, 140, 0) == GdPictureStatus.OK) && //The color used to draw the line.
(gdpicturePDF.SetLineWidth(0.5f) == GdPictureStatus.OK) && //the line width
(gdpicturePDF.DrawLine(2, 2, 18, 2) == GdPictureStatus.OK) &&
(gdpicturePDF.SetLineWidth(0.3f) == GdPictureStatus.OK) &&
(gdpicturePDF.DrawLine(2, 4, 18, 4) == GdPictureStatus.OK) &&
(gdpicturePDF.SetLineColor(210, 105, 30) == GdPictureStatus.OK) &&
(gdpicturePDF.SetLineWidth(0.2f) == GdPictureStatus.OK) &&
(gdpicturePDF.SetLineDash(2, 1) == GdPictureStatus.OK) && //drawing a dash line
(gdpicturePDF.DrawLine(2, 6, 18, 6) == GdPictureStatus.OK) &&
(gdpicturePDF.DrawLine(2, 10, 18, 10) == GdPictureStatus.OK) &&
(gdpicturePDF.SetLineNoDash() == GdPictureStatus.OK) &&
(gdpicturePDF.DrawLine(18, 6, 18, 10) == GdPictureStatus.OK) &&
(gdpicturePDF.DrawLine(2, 6, 2, 10) == GdPictureStatus.OK))
{
status = gdpicturePDF.SaveToFile("test_DrawLine.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 NewPDF() method has failed with the status: " + status.ToString(), caption);
gdpicturePDF.Dispose();