Генерация векторного штрих-кода в виде объекта Vintasoft.Imaging.BarcodePathData
В этом разделе
Пример: Вот пример, который показывает, как создать векторный штрих-код в виде объекта Vintasoft.Imaging.BarcodePathData.
/// <summary>
/// Returns a barcode in vector form as Vintasoft.Barcode.BarcodePathData object.
/// </summary>
/// <param name="barcodeType">Barcode type.</param>
/// <param name="barcodeValue">Barcode value.</param>
/// <returns>A barcode in vector form as Vintasoft.Barcode.BarcodePathData object.</returns>
public static Vintasoft.Barcode.BarcodePathData GetBarcodeAsGraphicsPath(Vintasoft.Barcode.BarcodeType barcodeType, string barcodeValue)
{
// create the barcode writer
using (Vintasoft.Barcode.BarcodeWriter barcodeWriter = new Vintasoft.Barcode.BarcodeWriter())
{
// set barcode writer settings
barcodeWriter.Settings.Barcode = barcodeType;
barcodeWriter.Settings.Value = barcodeValue;
barcodeWriter.Settings.ValueVisible = false;
barcodeWriter.Settings.Value2DVisible = false;
// return barcode as GraphicsPath
return barcodeWriter.GetBarcodeAsBarcodePath();
}
}
''' <summary>
''' Returns a barcode in vector form as Vintasoft.Barcode.BarcodePathData object.
''' </summary>
''' <param name="barcodeType">Barcode type.</param>
''' <param name="barcodeValue">Barcode value.</param>
''' <returns>A barcode in vector form as Vintasoft.Barcode.BarcodePathData object.</returns>
Public Shared Function GetBarcodeAsGraphicsPath(barcodeType As Vintasoft.Barcode.BarcodeType, barcodeValue As String) As Vintasoft.Barcode.BarcodePathData
' create the barcode writer
Using barcodeWriter As New Vintasoft.Barcode.BarcodeWriter()
' set barcode writer settings
barcodeWriter.Settings.Barcode = barcodeType
barcodeWriter.Settings.Value = barcodeValue
barcodeWriter.Settings.ValueVisible = False
barcodeWriter.Settings.Value2DVisible = False
' return barcode as GraphicsPath
Return barcodeWriter.GetBarcodeAsBarcodePath()
End Using
End Function