GdPicture image identifier.
A member of the Barcode1DWriterType enumeration.
The data of the barcode to encode.
Left pixel destination of to top-left corner of bounding box the barcode.
Top pixel destination of to top-left corner of bounding box of the barcode.
Width of the bounding box of the barcode.
Height of the bounding box of the barcode.
Color of the barcode. A suitable color value can be obtained by using the ARGB() method.
A member of the BarcodeAlign enumeration.
Example





In This Topic
GdPicture14 Namespace / GdPictureImaging Class / Barcode1DWrite Method / Barcode1DWrite(Int32,Barcode1DWriterType,String,Int32,Int32,Int32,Int32,Color,BarcodeAlign) Method

Barcode1DWrite(Int32,Barcode1DWriterType,String,Int32,Int32,Int32,Int32,Color,BarcodeAlign) Method

In This Topic
Draws a 1D barcode on a GdPicture image. This method accepts a parameter to specify the barcode alignment into the specified bounding box. The default alignment is centered.
Syntax
'Declaration
 
Public Overloads Function Barcode1DWrite( _
   ByVal ImageID As Integer, _
   ByVal BarcodeType As Barcode1DWriterType, _
   ByVal Data As String, _
   ByVal DstLeft As Integer, _
   ByVal DstTop As Integer, _
   ByVal DstWidth As Integer, _
   ByVal DstHeight As Integer, _
   ByVal FillColor As Color, _
   ByVal Alignment As BarcodeAlign _
) As GdPictureStatus
public GdPictureStatus Barcode1DWrite( 
   int ImageID,
   Barcode1DWriterType BarcodeType,
   string Data,
   int DstLeft,
   int DstTop,
   int DstWidth,
   int DstHeight,
   Color FillColor,
   BarcodeAlign Alignment
)
public function Barcode1DWrite( 
    ImageID: Integer;
    BarcodeType: Barcode1DWriterType;
    Data: String;
    DstLeft: Integer;
    DstTop: Integer;
    DstWidth: Integer;
    DstHeight: Integer;
    FillColor: Color;
    Alignment: BarcodeAlign
): GdPictureStatus; 
public function Barcode1DWrite( 
   ImageID : int,
   BarcodeType : Barcode1DWriterType,
   Data : String,
   DstLeft : int,
   DstTop : int,
   DstWidth : int,
   DstHeight : int,
   FillColor : Color,
   Alignment : BarcodeAlign
) : GdPictureStatus;
public: GdPictureStatus Barcode1DWrite( 
   int ImageID,
   Barcode1DWriterType BarcodeType,
   string* Data,
   int DstLeft,
   int DstTop,
   int DstWidth,
   int DstHeight,
   Color FillColor,
   BarcodeAlign Alignment
) 
public:
GdPictureStatus Barcode1DWrite( 
   int ImageID,
   Barcode1DWriterType BarcodeType,
   String^ Data,
   int DstLeft,
   int DstTop,
   int DstWidth,
   int DstHeight,
   Color FillColor,
   BarcodeAlign Alignment
) 

Parameters

ImageID
GdPicture image identifier.
BarcodeType
A member of the Barcode1DWriterType enumeration.
Data
The data of the barcode to encode.
DstLeft
Left pixel destination of to top-left corner of bounding box the barcode.
DstTop
Top pixel destination of to top-left corner of bounding box of the barcode.
DstWidth
Width of the bounding box of the barcode.
DstHeight
Height of the bounding box of the barcode.
FillColor
Color of the barcode. A suitable color value can be obtained by using the ARGB() method.
Alignment
A member of the BarcodeAlign enumeration.

Return Value

A member of the GdPictureStatus enumeration.
Example
Rendering a centered 1D barcode into a new image and saving the result into a png file.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // String with numbers, which have to be encoded into a barcode.
    string data = "123456";
 
    int dstLeft = 10;
    int dstTop = 10;
    int dstWidth = 300; // Barcode width
    int dstHeight = 80; // Barcode height
 
    // Select the 1D barcode type.
    Barcode1DWriterType barcodeType = Barcode1DWriterType.Barcode1DWriterStandard2of5;
 
    int imageID = gdpictureImaging.CreateNewGdPictureImage(20 + dstWidth, 20 + dstHeight, 32, Color.White);
    gdpictureImaging.Barcode1DWrite(imageID, barcodeType, data, dstLeft, dstTop, dstWidth, dstHeight, gdpictureImaging.ARGB(0, 0, 0), BarcodeAlign.BarcodeAlignCenter);
    gdpictureImaging.SaveAsPNG(imageID, "output.png");
 
    // Release used resources.
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also