A newer version of this page is available. Switch to the current version.

Matrix 2 of 5

  • 2 minutes to read

Short Description

Matrix 2 of 5 is a linear one-dimensional bar code. Matrix 2 of 5 is a self-checking numerical-only bar code.

Unlike the Interleaved 2 of 5, all of the information is encoded in the bars; the spaces are of a fixed width and used only to separate the bars. Matrix 2 of 5 is used primarily for warehouse sorting, photo finishing, and airline ticket marking.

Barcode - Matrix 2 of 5

Bar Code Properties

The type of a bar code control’s Symbology property is Matrix2of5Generator.

The following properties are specific to the Matrix 2 of 5 type.


The following code creates a Matrix 2 of 5 bar code and specifies its main properties.

using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Windows.Forms;
using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraReports.UI;
// ...
public XRBarCode CreateMatrix2of5BarCode(string BarCodeText) {
    // Create a bar code control.
    XRBarCode barCode = new XRBarCode();

    // Set the bar code's type to Matrix 2 of 5.
    barCode.Symbology = new Matrix2of5Generator();

    // Adjust the bar code's main properties.
    barCode.Text = BarCodeText;
    barCode.Width = 400;
    barCode.Height = 100;

    // Adjust the properties specific to the bar code type.
    ((Matrix2of5Generator)barCode.Symbology).CalcCheckSum = false;
    ((Matrix2of5Generator)barCode.Symbology).WideNarrowRatio = 3;

    return barCode;

To add the XRBarCode to a report band, handle the report’s XRControl.BeforePrint event.

using System.Drawing.Printing;
// ...

private void XtraReport1_BeforePrint(object sender, PrintEventArgs e) {