Industrial 2 of 5
- 2 minutes to read
Short Description
Standard 2 of 5 is a low-density numerical bar code that was introduced in the 1960s. It has been used in the photofinishing and warehouse sorting industries, as well as to sequentially number airline tickets.
Bar Code Properties
The type of a bar code control’s Symbology property is Industrial2of5Generator.
The following properties are specific to the Industrial 2 of 5 type.
BarCodeGeneratorBase.CalcCheckSum
Gets or sets whether to calculate a checksum for the bar code.
Industrial2of5Generator.WideNarrowRatio
Gets or sets the density of a bar code’s bars.
Examples
The following code creates an Industrial 2 of 5 bar code and specifies its main properties.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-add-a-bar-code-to-a-report-e167.
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Windows.Forms;
using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraReports.UI;
// ...
public XRBarCode CreateIndustrial2of5BarCode(string BarCodeText) {
// Create a bar code control.
XRBarCode barCode = new XRBarCode();
// Set the bar code's type to Industrial 2 of 5.
barCode.Symbology = new Industrial2of5Generator();
// Adjust the main properties of the bar code.
barCode.Text = BarCodeText;
barCode.Width = 400;
barCode.Height = 100;
// Adjust the properties specific to the bar code type.
((Industrial2of5Generator)barCode.Symbology).CalcCheckSum = false;
((Industrial2of5Generator)barCode.Symbology).WideNarrowRatio = 3;
return barCode;
}
To add the XRBarCode to a report band, handle the report’s XRControl.BeforePrint event.