GdPicture.NET Reference Guide
Barcode1DWriteGetMinWidth Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : Barcode1DWriteGetMinWidth Method
A member of the Barcode1DWriterType enumeration.
The data of the barcode to encode.
Gets for the minimum width required to draw a specific barcode on a GdPicture image using one of the Barcode1DWrite methods.
Syntax
'Declaration
 
Public Function Barcode1DWriteGetMinWidth( _
   ByVal BarcodeType As Barcode1DWriterType, _
   ByVal Data As String _
) As Integer
public int Barcode1DWriteGetMinWidth( 
   Barcode1DWriterType BarcodeType,
   string Data
)
public function Barcode1DWriteGetMinWidth( 
    BarcodeType: Barcode1DWriterType;
    Data: String
): Integer; 
public function Barcode1DWriteGetMinWidth( 
   BarcodeType : Barcode1DWriterType,
   Data : String
) : int;
public: int Barcode1DWriteGetMinWidth( 
   Barcode1DWriterType BarcodeType,
   string* Data
) 
public:
int Barcode1DWriteGetMinWidth( 
   Barcode1DWriterType BarcodeType,
   String^ Data
) 

Parameters

BarcodeType
A member of the Barcode1DWriterType enumeration.
Data
The data of the barcode to encode.

Return Value

The minimum width required to draw the barcode. If 0, you can use the GetStat method to get the reason the method failed.
Example
Writing a 1-D Barcode onto an image and making its width twice the size of the minimum width required for the barcode to be visible.
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer
Dim Data As String = "978524"
Dim DstLeft As Integer
Dim DstTop As Integer
Dim DstWidth As Integer
Dim DstHeight As Integer
Dim Alignment As BarcodeAlign
Dim Angle As Integer
ImageID = oGdPictureImaging.CreateGdPictureImageFromFile("")
BarcodeType = Barcode1DWriterType.Barcode1DWriterCode11
DstLeft = 100
DstTop = 100
Alignment = BarcodeAlign.BarcodeAlignLeft
DstWidth = oGdPictureImaging.Barcode1DWriteGetMinWidth(BarcodeType, Data)
DstWidth = 2 * DstWidth
DstHeight = CInt(DstWidth / 3)
oGdPictureImaging.Barcode1DWrite(ImageID, BarcodeType, Data, DstLeft, DstTop, DstWidth, DstHeight, Imaging1.ARGB(0, 0, 0), Alignment)
oGdPictureImaging.SaveAsPNG(ImageID, "output.png")
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members