The requested page is not available for the requested platform. You are viewing the content for Default platform.

QR Code

Short Description

A QR Code (QR is the abbreviation for Quick Response) is a two-dimensional code, readable by QR scanners, mobile phones with a camera, and smartphones. QR Code can encode textual, numeric and binary data.

qrcode

Bar Code Properties

The type of a bar code control's Symbology property is QRCodeGenerator.

The following properties are specific to the QR type.

Examples

The following code creates a QR Code 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 CreateQRCodeBarCode(string BarCodeText) {
    // Create a bar code control.
    XRBarCode barCode = new XRBarCode();

    // Set the bar code's type to QRCode.
    barCode.Symbology = new QRCodeGenerator();

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

    // If the AutoModule property is set to false, uncomment the next line.
    barCode.AutoModule = true;
    // barcode.Module = 3;

    // Adjust the properties specific to the bar code type.
    ((QRCodeGenerator)barCode.Symbology).CompactionMode = QRCodeCompactionMode.AlphaNumeric;
    ((QRCodeGenerator)barCode.Symbology).ErrorCorrectionLevel = QRCodeErrorCorrectionLevel.H;
    ((QRCodeGenerator)barCode.Symbology).Version = QRCodeVersion.AutoVersion;

    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) {
    this.Detail.Controls.Add(CreateQRCodeBarCode("012345678"));
}
See Also