Back to Devexpress

How to: Display QR Bar Code in BarCodeControl

windowsforms-11986-controls-and-libraries-editors-and-simple-controls-examples-how-to-display-qr-bar-code-in-barcodecontrol.md

latest1.5 KB
Original Source

How to: Display QR Bar Code in BarCodeControl

  • Oct 25, 2019

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

csharp
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;
vb
Imports DevExpress.XtraPrinting.BarCode
Imports DevExpress.XtraEditors

Dim barCodeControl1 As BarCodeControl = New BarCodeControl()
barCodeControl1.Parent = Me
barCodeControl1.Size = New System.Drawing.Size(150, 150)
barCodeControl1.AutoModule = True
barCodeControl1.Text = "1234567890"
Dim symb As QRCodeGenerator = New QRCodeGenerator()
barCodeControl1.Symbology = symb

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