Skip to main content
A newer version of this page is available. .

BarCodeControl Class

Displays a bar code.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v19.1.dll

Declaration

[ToolboxBitmap(typeof(ToolboxIconsRootNS), "BarCodeControl")]
public class BarCodeControl :
    BaseControl

Remarks

The BarCodeControl supports multiple bar code types. The following images illustrate some of them.

QR Code EAN 8 PDF417
BarCode-QRCode-ex BarCode-EAN8-ex BarCode-PDF417-ex

The bar code type is specified by the BarCodeControl.Symbology property.

  • At design time within Visual Studio, you can set this property using the Properties window.

    BarCode-SymbologyProperty-DT

    After selecting a bar code type, you can expand the Symbology property to access additional customization options.

    BarCode-SymbologyProperty-DT-Expanded

  • To specify the symbology in code, create a specific BarCodeGeneratorBase descendant and assign it to the Symbology property of the BarCodeControl.

    A bar code generator object provides access to additional customization properties specific to the selected bar code type.

Some of the main bar code options are described below.

Example

This example illustrates how to use BarCodeControl to display a QR code.

BarCode-QRCode-ex2

using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraEditors;

BarCodeControl barCodeControl1 = new BarCodeControl();
barCodeControl1.Parent = this;
barCodeControl1.Size = new System.Drawing.Size(150, 150);
barCodeControl1.AutoModule = true;
barCodeControl1.Text = "1234567890";
QRCodeGenerator symb = new QRCodeGenerator();
barCodeControl1.Symbology = symb;

// Adjust the QR barcode's specific properties.
symb.CompactionMode = QRCodeCompactionMode.AlphaNumeric;
symb.ErrorCorrectionLevel = QRCodeErrorCorrectionLevel.H;
symb.Version = QRCodeVersion.AutoVersion;
See Also