Methods of using the barcode image

To paint the control's Picture on the form use the PaintPicture method, or draw your own bars using the Printers Line method. Using the PaintPicture method the code will look like this:

 

If AdBarcode1.ErrorCode = 0 Then
    Form1.PaintPicture AdBarcode1.Picture, 20, 20, i, j

where the (20,20) specifies the coordinates on the form of the top left-hand corner of the barcode image, and i and j represent the required width and height of the image respectively.

The control’s Picture may be passed to the clipboard using

I = AdBarcode1.CopyImage()

The Visual Basic Picture object contains a metafile image of the generated barcode. In the event of an error in barcode image generation the image is empty, and the ErrorCode property is set to a non-zero value;

The control's Picture may be printed from VB6 using the PaintPicture method of the Printer object, eg.

 

Printer.ScaleMode = 6  ' sets printer scale to mm

Printer.PaintPicture AdBarcode1.Picture, 20, 20,  AdBarcode1. PictureWidth,     AdBarcode1. PictureHeight

Printer.NewPage

Printer.EndDoc

Where the (20,20) refers to the top, left coordinates of the barcode image on the printer's page.

Note that the PrintForm method may also be used, although on some systems this may show images of unsuitable resolution.

For printing the image using VB.NET or C# see Creating a barcode picture under Using Active 2D-Barcode Control in VB & .NET

The image created by the Active 2D-Barcode Control may also be saved in a file in a graphics format using the SaveImage(filename) method. The image type must be specified by using the permitted filename extensions - .wmf, .bmp, .eps, .pcx, png, or .gif. (gif file production requires a gif licence from Unisys Corp.)

 

More:

Required Properties