Index
 EasyBar/VBX

Properties 	Example1	Example2	Barcode Types	Caveat

Description

EasyBar/VBX is a Visual Basic Custom Control for creating barcodes. It allows using various drawing attributes including rotation, text position, font, etc. The barcode parameters (bar/space widths, margins, etc.) are fine-tunable. 20 barcode types are supported, of which 12 are basic types and 10 with add-ons.

EasyBar/VBX is invisible at run-time, and there are no events for it. To use it, you need to set the PrintTo action property to either your forms hDC property or Printer.hDC.

EasyBar/VBX is only intended to be used in Visual Basic 3.0. If you are programming in C++ or C, you should opt for EasyBar/DLL, even if your programming system supports VBX. Also, EasyBar/VBX doesnt have all the functionalities of EasyBar/DLL: it does not allow to change the barcode type at run time, nor to adjust the bar and space widths at run time.

File Name

EASYBARX.VBX

Object Type

BARCODE

Distribution Files

There is only one file needed for both design time and run-time:

EASYBARX.VBX


Properties

All of the properties supported by EasyBar/VBX are listed below. Properties that apply only to this control, or require special consideration when used with it, are underlined. The other properties are documented in Visual Basics on-line help and in the Visual Basic Custom Control Reference (see the section Standard Properties, Events, and Methods Appendix A).

(About)	(Tuning)	ActualLeft

ActualHeight	ActualTop	ActualWidth

AddOnData	AddOnMessage	AddOnTextAlign

BackColor	BarcodeType	CalcSizeOnly

Data	FigureHeight	FigureLeft

FigureTop	FigureTransparent	FigureWidth

FontBold	ForeColor	FontItalic

FontName	FontItalic	FontSize

FontStrikethru	FontUnderline	HorzAlign

Index	Left	Message

Name	NumModules	Orientation

PixelAlign	PrintTo	RetainAspectRatio

StretchText	Tag	TextAlign

Top	UniBarHeight	UpcSmallFont

VertAlign	WhichRect


Example1

The following example shows how to print a barcode on a form. It uses the barcode type set at design time:

Sub Form_DblClick ()

Barcode1.Data = "12345678"

Barcode1.PrintTo = hDC

End Sub


Example2

The following example shows how to print a barcode on Windows default printer. It uses the barcode type set at design time:

Sub Form_DblClick ()

Barcode1.Data = "12345678"

Barcode1.PrintTo = Printer.hDC

Printer.EndDoc

Printer.NewPage

End Sub


(Tuning)
(Tuning) Property

Description

At design time, use this property to adjust the margins and the bar and space widths of the barcode. Not available at run time.

Remarks

The default values of the bar and space widths work the best when the target printer prints the white and black pixels using the same size. However, when your printer fails to do so, you may need to adjust them to compensate for the black/white pixel size difference.


ActualLeft
ActualLeft Property

Description

Indicates, after a printing, the x-coordinate of the upper-left corner of the entire barcode rectangle, the main barcode rectangle or the add-on barcode rectangle, depending on the current value of the WhichRect property. Not available at design time; read-only at run time.

Usage

[form.]Barcode.ActualLeft

Remarks

The coordinate is measured in twips from the upper-left corner of the printer or form where the barcode is printed. The value of this property is meaningful only after you have used the PrintTo property to do a printing.

This property can be useful when you want to print other things relative to the barcode.

Data Type

Integer

See Also

WhichRect, ActualTop, ActualWidth, ActualHeight.


ActualTop
ActualTop Property

Description

Indicates, after a printing, the y-coordinate of the upper-left corner of the entire barcode rectangle, the main barcode rectangle or the add-on barcode rectangle, depending on the current value of the WhichRect property. Not available at design time; read-only at run time.

Usage

[form.]Barcode.ActualTop

Remarks

The coordinate is measured in twips from the upper-left corner of the printer or form where the barcode is printed. The value of this property is meaningful only after you have used the PrintTo property to do a printing.

This property can be useful when you want to print other things relative to the barcode.

Data Type

Integer

See Also

WhichRect, ActualLeft, ActualWidth, ActualHeight.


ActualHeight
ActualHeight Property

Description

Indicates, after a printing, the height of the entire barcode rectangle, the main barcode rectangle or the add-on barcode rectangle, depending on the current value of the WhichRect property. Not available at design time; read-only at run time.

Usage

[Form.]Barcode.ActualHeight

Remarks

The height is measured in twips. It is meaningful only after you have used the PrintTo property to do a printing.

This property can be useful when you want to print other things relative to the barcode.

Data Type

Integer

See Also

WhichRect, ActualLeft, ActualWidth, ActualTop.


PrintTo
PrintTo Property

Description

Use this property to trigger the actual print action. To print to a form, set it to the forms hDC property; to print to the default printer, set it to Printer.hDC. Not available at design time; write-only at run time.

Usage

[Form.]Barcode.PrintTo [ = {form|Printer}.hDC]

Data Type

Integer

See Also

CalcSizeOnly.


ActualWidth
ActualWidth Property

Description

Indicates, after a printing, the width of the entire barcode rectangle, the main barcode rectangle or the add-on barcode rectangle, depending on the current value of the WhichRect property. Not available at design time; read-only at run time.

Usage

[form.].Barcode.ActualWidth

Remarks

The width is measured in twips. It is meaningful only after you have used the PrintTo property to do a printing.

This property can be useful you when you want to print other things relative to the barcode.

Data Type

Integer

See Also

WhichRect, ActualLeft, ActualHeight, ActualTop.


AddOnData
AddOnData Property

Description

Determines the data used by the add-on part of the barcode.

Usage

[form.].Barcode.AddOnData [ = {value$}]

Remarks

This property is only available in barcodes with an add-on part.

At run time, if you assign this property a value that is invalid for the current barcode type, no error will be thrown; instead, an internal default value ("00...") will be used.

Data Type

String


Data
Data Property

Description

Determines the data used by the main part of the barcode.

Usage

[form.].Barcode.Data [ = {value$}]

Remarks

At run time, if you assign this property a value that is invalid for the current barcode type, no error will be thrown; instead, an internal default value ("000000...") will be used.

Data Type

String


AddOnMessage
AddOnMessage Property

Description

Determines the text to be displayed with the add-on part of the barcode.

Usage

[Form.].Barcode.AddOnMessage [ = {value$}]

Remarks

When this property is set, its value will be displayed with the barcode in lieu of the value derived from the AddOnData property.

Data Type

String


AddOnTextAlign
AddOnTextAlign Property

Description

Determines the alignment of the displayed text associated with the add-on part of the barcode.

Usage

[form.].Barcode.AddOnTextAlign [ = {value%}]

Setting

Setting	Value

0	(Default) Text on top the barcode.

1	Text under the barcode.

Data Type

Integer


BarcodeType
BarcodeType Property

Description

Specifies the barcode type. Not available at run time.

Setting

Setting	Value

0	(Default) Code 39.

1	2 of 5.

2	Interleaved 2 of 5.

3	Codabar.

4	Code 93.

5	UPC-A.

6	UPC-A + 2.

7	UPC-A + 5.

8	UPC-E.

9	UPC-E + 2

10	UPC-E + 5.

11	EAN-13.

12	EAN13 + 2.

12	EAN-13 + 5.

14	EAN-8.

15	EAN-8 + 2.

16	EAN-8 + 5.

17	EAN-128 A.

18	EAN-128 B.

19	EAN-128 C.

Remarks

This property is not available at run time. If you need to support multiple barcode types in your program, you should put multiple EasyBar/VBX instances on your form..

Data Type

Integer (Enumerated)


FigureHeight
FigureHeight Property

Description

Specifies the desired height of the barcode.

Usage

[Form.].Barcode.FigureHeight [ = {value%}]

Remarks

The value is in twips.

Data Type

Integer


FigureLeft
FigureLeft Property

Description

Specifies the desired x-coordinate of the upper-left corner of the barcode rectangle.

Usage

[Form.].Barcode.FigureLeft [ = {value%}]

Remarks

The value is in twips.

Data Type

Integer


FigureTop
FigureTop Property

Description

Specifies the desired y-coordinate of the upper-left corner of the barcode rectangle.

Usage

[Form.].Barcode.FigureTop [ = {value%}]

Remarks

The value is in twips.

Data Type

Integer (Boolean)


FigureWidth
FigureWidth Property

Description

Specifies the desired width of the barcode.

Usage

 [Form.].Barcode.FigureWidth [ = {value%}]

Remarks

The value is in twips.

Data Type

Integer


FigureTransparent
FigureTransparent Property

Description

Specifies whether the barcode should be drawn transparently on the background.

Usage

[Form.].Barcode.FigureTransparent [ = {TRUE | FALSE}]

Setting

Setting	Value

TRUE	(Default) The barcode will be transparent.

FALSE	The barcode will be opaque.

Data Type

Integer (Boolean)


FontName
FontName Property

Description

Specifies the name of the font to be used. This is a standard property; however, with EasyBar/VBX, if you are using a rotation angle (Orientation) other than 0, make sure to choose a TrueType font.

Usage

[Form.].Barcode.FontName [ = {FontName$}]

Data Type

String


HorzAlign
HorzAlign Property

Description

Specifies the horizontal alignment of the barcode within the desired rectangle.

Usage

[Form.].Barcode.HorzAlign [ = {value%}]

Setting

Setting	Value

0	(Default) left-aligned.

1	Centered.

2	Right-aligned.

Data Type

Integer


Message
Message Property

Description

Specifies the display text of the main part of the barcode.

Usage

[Form.].Barcode.Message [ = {value$}]

Remarks

When this property is not set, the display text is derived from the value of the Data property.

Data Type

String


NumModules
NumModules Property

Description

Indicates the number of modules comprising the barcode. Not available at design time; read-only at run time.

Usage

[Form.].Barcode.NumModules

Remarks

A module is the smallest unit in terms of which all the bar and space widths of the barcode are expressed..

Data Type

Integer


Orientation
Orientation Property

Description

Determines the rotation angle of the barcode.

Usage

[Form.].Barcode.Orientation [ = {value%}]

Setting

Setting	Value

0	(Default) Not rotated.

1	Rotated 90° counter-clockwise.

2	Rotated 180° counter-clockwise.

3	Rotated 270° counter-clockwise.

Data Type

Integer (Enumerated)


PixelAlign
PixelAlign Property

Description

Determines whether the bar and space widths are pixel-aligned.

Usage

[Form.].Barcode.PixelAlign [ = {TRUE | FALSE}]

Setting

Setting	Value

TRUE	(Default) Bar and space widths are pixel-aligned.

FALSE	Not pixel-aligned; actual barcode size will be the same as the desired size.

Remarks

When this property is TRUE, the actual barcode size will be adjusted, so that all the bar and space widths correspond to an integral number of pixels. This property should always be set to TRUE when printing to printer, unless the printer resolution is very high; otherwise, the barcode may not be readable.

Data Type

Integer (Boolean)


RetainAspectRatio
RetainAspectRatio Property

Description

Determines if the desired width/height ratio should be retained when the barcode size is adjusted (due to the setting of the PixelAlign property to TRUE).

Usage

[Form.].Barcode.RetainAspectRatio [ = {TRUE | FALSE}]

Setting

Setting	Value

TRUE	(Default) The barcode width/height ratio is retained.

FALSE	The barcode width/height ratio is not retained.

Data Type

Integer (Boolean)


AutoSelect
StretchText Property

Description

Specifies whether the barcode text should be stretched to take the whole width of the barcode.

Usage

[Form.].Barcode.StretchText [ = {TRUE | FALSE}]

Setting

Setting	Value

TRUE	(Default) The barcode text will be stretched.

FALSE	The barcode text will not be stretched.

Data Type

Integer (Boolean)


TextAlign
TextAlign Property

Description

Specifies the main barcode text alignment.

Usage

[Form.].Barcode.TextAlign [ = {value%}]

Setting

Setting	Value

0	The barcode text will be displayed above the barcode.

1	(Default) The barcode text will be displayed beneath the barcode.

2	Hidden.

Data Type

Integer (Enumerated)


UniBarHeight
UniBarHeight Property

Description

Specifies whether to use one unique bar height throughout. Applicable only for UPC and EAN barcode types.

Usage

[Form.].Barcode.UniBarHeight [ = {TRUE | FALSE}]

Setting

Setting	Value

TRUE	One bar height.

FALSE	(Default) Two bar heights when applicable.

Data Type

Integer (Boolean)


CalcSizeOnly
CalcSizeOnly Property

Description

Specifies whether the subsequent PrintTo property assignment will actually print out or is for calculation purpose only. Not available at design time; write-only at run time.

Usage

[Form.].Barcode.CalcSizeOnly = {TRUE | FALSE}

Setting

Setting	Value

TRUE	Subsequent PrintTo assignment will not actually print out.

FALSE	(Default) Subsequent PrintTo assignment will actually print out.

Data Type

Integer (Boolean)


UpcSmallFont
UpcSmallFont Property

Description

Specifies whether the first and last digits of a UPC type barcode should be displayed with a smaller font.

Usage

[Form.].Barcode.UpcSmallFont [ = {TRUE | FALSE}]

Setting

Setting	Value

TRUE	(Default) Smaller font for the first and last digits of a UPC type barcode.

FALSE	Same font size throughout.

Data Type

Integer (Boolean)


VertAlign
VertAlign Property

Description

Specifies the vertical alignment of the barcode within the desired rectangle.

Usage

[Form.].Barcode.VertAlign [ = {value%}]

Setting

Setting	Value

0	(Default) top-aligned.

1	Vertical-centered.

2	Bottom-aligned.

Data Type

Integer


WhichRect
WhichRect Property

Description

Specifies for which rectangle to retrieve information. To be used along with the ActualLeft, ActualTop, ActualWidth, ActualHeight properties. Not available at design time.

Usage

[Form.].Barcode.WhichRect [ = value%]

Setting

Setting	Value

0	(Default) Bounding rectangle of the entire barcode.

1	Bounding rectangle of the main part of the barcode.

2	Bounding rectangle of the add-on part of the barcode.

Data Type

Integer (Enumerated)


Barcode Types
Supported Barcode Types

Basic Types

2 of 5	Interleaved 2 of 5	Code 39

Code 93	Codabar	EAN-8

EAN-13	UPC-A	UPC-E

EAN-128 A	EAN-128 B	EAN-128 C

Types with Add-ons

EAN-8 + 2	EAN-8 + 5

EAN-13 + 2	EAN-13 + 5

UPC-A + 2	UPC-A + 5

UPC-E + 2	UPC-E + 5


2 of 5

2 of 5 is a non-continuous barcode without check character. Its character set is '0' to '9'.

The following default values are used:

- wide/narrow bar ratio = 3

- space width = narrow bar width

- intercharacter gap = narrow bar


Interleaved 2 of 5

Interleaved 2 of 5 is a continuous barcode. Its character set is '0' to '9'. The number of characters should be even. The check character is optional and not implemented in Easybar/VBX. You can always integrate it into the data (last digit) should you need it.

The following default value is used:

- wide/narrow bar ratio = 3


Code 39

Code 39 is a non-continuous barcode. Its character set is composed of '0' to '9', 'A' to 'Z', SPACE, '*', '$', '/', '+', '-', '.', '%'. The check character is optional and not implemented in Easybar/DLL; you may always integrate it into the data (last digit) should you need it.

The following default values are used:

- wide/narrow bar ratio = 3

- intercharacter gap = 2 * narrow bar

The character '*' being built in as both the start and stop characters of the barcode, you should not attempt to set them any more as part of the data. Also, by default, you will not see '*'s in the display text; to show them, you have to resort to the Message property.


Code 93

Code 93 is a continuous barcode with character set composed of '0' to '9', 'A' to 'Z', '-', '.', SPACE, '*', '$', '/', '+', '%' (plus special characters). It has two check characters (not displayed as part of the display text in Easybar/VBX).

The following default value is used:

- bar width = space width


Codebar
Codabar

Codabar is a non-continuous barcode without check character. Its character set is composed of '0' to '9', 'A', 'B', 'C', 'D', '$', '-', ':', '/', '.', '+'. 'A' to 'D' are eligible only for start/stop characters. Though the characters 'T', 'n', '*', 'e' may be used instead of 'A', 'B', 'C', 'D', in Easybar/VBX, you cannot directly use them to set data. You may, of course, display them (as well as any other characters) through the Message property.

The following default values are used:

- wide/narrow bar ratio = 3

- intercharacter gap = 2 * narrow bar


UPC-A

UPC-A has a fixed length of 11 characters plus the check character. Its character set is '0' to '9'.

See Also

UPC-A + 2, UPC-A + 5


UPC-E

UPC-E has a fixed length of 7 characters plus the check character. Its character set is '0' to '9'.

See Also

UPC-E + 2, UPC-E + 5


EAN-13

EAN-13 has a fixed length of 12 characters plus the check character. Its character set is '0' to '9'.

See Also

EAN-13 + 2, EAN-13 + 5


EAN-8

EAN-8 has a fixed length of 7 characters plus the check character. Its character set is '0' to '9'.

See Also

EAN-8 + 2, EAN-8 + 5


UPC-A + 2

See Also

UPC-A, UPC-A + 5


UPC-A + 5

See Also

UPC-A, UPC-A + 2


UPC-E + 2

See Also

UPC-E, UPC-E + 5


UPC-E + 5

See Also

UPC-E, UPC-E + 2


EAN-13 + 2

See Also

EAN-13, EAN-13 + 5


EAN-13 + 5

See Also

EAN-13, EAN-13 + 2


EAN-8 + 2

See Also

EAN-8, EAN-8 + 5


EAN-8 + 5

See Also

EAN-8, EAN-8 + 2


EAN-128 A

EAN-128 A is a continuous barcode. Its character set is ASCII 0 to 95 (plus special characters). It has one check character (not shown as part of the dispaly text in Easybar/VBX).


EAN-128 B

EAN-128 B is a continuous barcode. Its character set is ASCII 32 to 127 (plus special characters). It has one check character (not shown as part of the display text in Easybar/VBX).


EAN-128 C

EAN-128 C is a continuous barcode. Its character set is '0' to '9' (plus special characters), internally coded every two characters. It has one check character (not shown as part of the display text in Easybar/VBX). The number of single digit characters (excluding the check character) must be even.


Caveats
Caveat

When you use a rotation angle other than 0 for the Orientation property,  the text of the barcode might not be positioned appropriately on the printer, depending on the printer that you are using. As a workaround, you may elect to hide the text by setting the TextAlign and AddOnTextAlign properties to 2 (hidden). And then you can also write your own code to print text, the actual size and position of the barcode being retrievable through the properties ActualLeft, ActualTop, ActualWidth and ActualHeight.


For information, contact:

Bokai Corporation

1221 Dundix Rd., #106

Mississauga, ON  L4Y 3Y9   Canada

Fax: 905 276-7692

CompuServe: 75333,1235