flag german flag uk flag us Tip: Bookmark this page with Ctrl-D (Win) or Apple-D (Mac) MainProductsKnow How / FAQDownloadStoreContact



DISCONTINUED PRODUCT. PLEASE REFER TO OUR NEW .NET BARCODE LIBRARY AND CONTROL.

Manual - Forms Control Code 128 - Reference

Properties

Name Type Comment
dataToEncode String Data to encode in the barcode. String can have up to 128 characters (the practical limit for Code 128 is 40, though).

With gs1 set to true: ASCII data only.

With gs1 set to false: To encode non-printable charaters, e.g. a TAB, use the tilde, followed by the ASCII code, left padded with "0" to three digits. E.g. to encode a TAB, write "~009". To encode an FNC1 character (if you want to assemble your own Code 128 GS1 symbols), write "~999". To encode a tilde, write "~0126".

Note: When encoding non-printable characters make sure your scanner can actually read and transmit such data - this is not a given, especially if the scanner emulates a keyboard, e.g. via a wedge or USB.

Default: "Code 128"
 
moduleWidth Float Width of the smallest bar (= module) in mm.

The smallest acceptable value depends on the print resolution, for Code 128 GS1 the value should be between 0.495 and 1.016 mm.

Default: 0.5 mm
 
moduleHeight Float Height of the barcode in mm.

The smallest acceptable value depends on the application, values under 8 mm should be avoided, for Code 128 GS1 the value should be 32 mm.

Default: 25 mm
 
gs1 Boolean False: create a normal Code 128. True: Create a Code 128 GS1

Barcodewise, both code types differ as follows:

a. With Code 128 GS1, an FNC1 character is put after the start symbol.

b. With Code 128 GS1, application identifiers in parentheses are evaluated. This has two effects: Firstly, the parentheses are stripped from the encoded data (removing them from the barcode, but retaining them for the human readable text, in accordance with the standard), secondly, variable fields are terminated with an FNC1.

All this happens behind the stage; besides setting the gs1 flag to true nothing else has to be done.

Note, however, that you have to provide to the control a correctly formatted string, including all application identifiers and parentheses, e.g. to create a barcode for an SSCC18 you'll have to set the dataToEncode property to a string like this: "(00)340123451234567895". Please refer to the respective GS1 specifications.

Default: false
 
humanReadable Boolean Display human readable text under the barcode.

Default: true
 
humanReadableFont String Name of the font to use for the human readable text.

Default: "Arial"
 
humanReadableSize Float Size of the font for the human readable text in points.

Default: 12 pt.
 
marginX Float Left and right margin of the barcode. Should not be under 5 mm.

Default: 5 mm.
 
marginY Float Top and bottom margin of the barcode. Should not be under 5 mm.

Default: 5 mm.
 

Methods

Name Parameter Comment
createCode Float dpi Creates a barcode, returns a Bitmap with the code. The dpi parameter determines the output resolution, e.g. 300 for 300 dpi. The actual dimensions of the barcode (and, hence, the returned bitmap) are determined from the moduleHeight, moduleWidth and the encoded data.

Returns: Bitmap
 
bitpattern_c128 String data Creates the actual bitpattern of a Code 128 barcode in form of an array. Bars are set to '1' in the array, spaces are set to '0'. Will also perform the tilde-substitution as described above. See the description of the C# sample for an example.

Returns: char [] - Note: Returns an empty array when in demo mode.
 
bitpattern_c128gs1 String data Creates the actual bitpattern of a Code 128 GS1 barcode in form of an array. Bars are set to '1' in the array, spaces are set to '0'. Will also perform the parentheses-evaluation as described above.

Returns: char [] - Note: Returns an empty array when in demo mode.
 
resetToDefaults void Resets all properties to the defaults as described in this document.

Returns: void
 
unlock String user
String key
Unlock the control and remove the restrictions of the demo. See the supplied sample projects for an example.

Returns: Boolean - True: Successfully unlocked; False: Error.
 

Data binding

The dataToEncode property of the control is data-bindable. To bind the property at design time, select the control and hit F4 to display the properties; scroll down to DataBindings.

screenshot fc1

Select Advanced and click the "..." button to open the Advanced Binding Dialog:

screenshot fc1

Locate the dataToEncode property in the list and open the Binding drop-down to select an existing data source or to create a new datasource.

Of course it's also possible to data bind the property at runtime.