Barcode Control Properties

Apart from the common properties such as Width, Height, ForeColor and Font of a control, the ConnectCode Barcode Control provides additional custom properties used in the production of barcodes. These custom properties are

Data - This property lets you enter the data of the barcode as a text string.

BarcodeType - This property allows you to specify the barcode symbology. Different barcodes have their strenghts and unique properties. ConnectCode Barcode Control supports all the important ones.

Some barcodes like Code 128 are very compact. EAN and UPC are used widely in retail. Variations of EAN are used in books, magazines, and music media items. I2of5 and ITF are used in commonly in the manufacturing and logistics industries. UCCEAN are used in shipping and trade items. GS1 Databar are compact modern barcodes intended to replace some of the older ones.

Valid Values

  • Barcodes.BarcodeEnum.Code128Auto
  • Barcodes.BarcodeEnum.Code128A
  • Barcodes.BarcodeEnum.Code128B
  • Barcodes.BarcodeEnum.Code128C
  • Barcodes.BarcodeEnum.Code39
  • Barcodes.BarcodeEnum.Code39ASCII
  • Barcodes.BarcodeEnum.Code93
  • Barcodes.BarcodeEnum.CodeCodabar
  • Barcodes.BarcodeEnum.EAN13
  • Barcodes.BarcodeEnum.EAN8
  • Barcodes.BarcodeEnum.EXT2
  • Barcodes.BarcodeEnum.EXT5
  • Barcodes.BarcodeEnum.I2of5
  • Barcodes.BarcodeEnum.Industrial2of5
  • Barcodes.BarcodeEnum.ITF14
  • Barcodes.BarcodeEnum.ModifiedPlessy
  • Barcodes.BarcodeEnum.POSTNET
  • Barcodes.BarcodeEnum.UCCEAN
  • Barcodes.BarcodeEnum.UPCA
  • Barcodes.BarcodeEnum.UPCE
  • Barcodes.BarcodeEnum.GS1Databar14
  • Barcodes.BarcodeEnum.GS1DatabarTruncated
  • Barcodes.BarcodeEnum.GS1DatabarLimited
  • Barcodes.BarcodeEnum.GS1DatabarExpanded


CheckDigit - The CheckDigit is usually an additional character or number that is computed from the data string and appended to the barcode to ensure the integrity of the data when the barcode is being scanned.

Some barcodes requires a CheckDigit as part of their specification, while others do not. For the barcodes that allows their Check Digits to be optionally turned on or off, this property lets you specify whether you want to display or hide the Check Digit.

Valid Values


  • Barcodes.YesNoEnum.Yes
  • Barcodes.YesNoEnum.No


Rotation - This property specifies the anlge of rotation of the barcode.

Valid Values


  • Barcodes.RotateEnum.None
  • Barcodes.RotateEnum.Angle90
  • Barcodes.RotateEnum.Angle180
  • Barcodes.RotateEnum.Angle270
TextAlignment - This property specifies the alignment of the human readable text relative to the barcode.

Valid Values


  • Barcodes.TextAlignmentEnum.Left
  • Barcodes.TextAlignmentEnum.Center
  • Barcodes.TextAlignmentEnum.Right

TextLocation - This property specifies the location of the human readable text relative to the barcode.

Valid Values


  • Barcodes.TextLocationEnum.Top
  • Barcodes.TextLocationEnum.Bottom

EANStandards - This property applies to the EAN13 barcode. When it is set to None, the standard EAN barcode is drawn. When set to ISBN, it will draw the standard ISBN barcode used in books. When set to ISBN13, it will draw the modern ISBN13 barcode. When set to ISSN, it will draw the ISSN barcodes used in magazines.

Valid Values


  • Barcodes.EANStandardsEnum.None
  • Barcodes.EANStandardsEnum.ISBN
  • Barcodes.EANStandardsEnum.ISBN13
  • Barcodes.EANStandardsEnum.ISSN

ExtendedStyle - The EAN8 , EAN13, UPCA, UPCE barcodes support the ExtendedStyle such that a few barcode lines will be extended downwards and surround the text.

Valid Values


  • Barcodes.YesNoEnum.Yes
  • Barcodes.YesNoEnum.No

BearersBar - The BearersBar is applicable to the ITF14 barcode. When it is set to TopBottom, a pair of thick horizontal lines will be drawn at the top and bottom of the barcode.

When it is set to Rectangle, a thick rectangle will be drawn around the barcode. The purpose of the Bearers bar is to ensure that the barcode is read completely.

Valid Values


  • Barcodes.BearersEnum.TopBottom
  • Barcodes.BearersEnum.Rectangle

MinBarWidth - Minimum Bar Width in Twips. 1 twip = 1/1440 inch. A typical value to start with is 35. A maximum value of 100 is allowed. If set to 0, the minimum bar width will be automatically calculated based on the bounding box.

Note - For the WPF Barcode Control, the minimum bar width is specified in pixels. A typical value to start with is 2.

BarWidthRatio - Thick to Thin Bar Ratio. A value from 2.0 to 3.0. This property only applies to the Code 39, Code 39 ASCII, Codabar, I2OF5 and ITF14 barcodes.

ITFQuietZone - ITF14 Barcode Quiet Zone. Values from 10x to 15x of the MinBarWidth are allowed.

ConnectCode Barcode Control Methods

The ConnectCode Barcode Control provides several methods that may be used for creating barcode images or rendering the barcodes into a graphics context.

void SaveBarcodeAsImage(string filename, System.Drawing.Imaging.ImageFormat format) - This method lets you save the barcode as an image. Some of the supported ImageFormats are

  • System.Drawing.Imaging.ImageFormat.Png
  • System.Drawing.Imaging.ImageFormat.Bmp
  • System.Drawing.Imaging.ImageFormat.Jpeg
  • System.Drawing.Imaging.ImageFormat.Tiff

It is recommended that you use PNG because it supports compression and is lossless. This can help in the scanning of the barcode image.

void DrawBarcode(Graphics gp, Rectangle clrect) - This method lets you draw the barcode to a Graphics object gp within a rectangle clrect. The resolution used is 1440 DPI (Point is 1/72. Page Scale is 1/20. Total 1/1440).

Please note that this method draw the barcode on the origin (0,0) location. You may be interested to use the GetPNGImage method to draw the barcode on your System.Drawing.Graphics object.

Byte[] GetPNGImage() - This method is used to create a barcode image (System.Drawing.Image) object to be drawn on the graphics object (System.Drawing.Graphics). It returns an array of bytes that can be used by the System.IO.MemoryStream class.

The table below illustrates how to create an image object using this function.



BarcodeControl barcodeControl1 = new BarcodeControl();
.
.
//initialize barcode parameters
.
.
System.IO.MemoryStream ms = new
System.IO.MemoryStream(barcodeControl1.GetPNGImage());
Image image = System.Drawing.Image.FromStream(ms);
g.DrawImage(image, new Point(50, 50));
//where g is a System.Drawing.Graphics object