Skip to main content

QR Code

  • 2 minutes to read

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.

BarCode-QRCode

Example

using DevExpress.Drawing;
using System.Text;
using DevExpress.BarCodes;
// ...

static void Main(string[] args)
{
    // Create a QR code.
    BarCode barCode = new BarCode();
    barCode.Symbology = Symbology.QRCode;
    barCode.CodeText = "https://www.devexpress.com";
    barCode.BackColor = Color.White;
    barCode.ForeColor = Color.Black;
    barCode.RotationAngle = 0;
    barCode.CodeBinaryData = Encoding.Default.GetBytes(barCode.CodeText);
    barCode.Options.QRCode.CompactionMode = QRCodeCompactionMode.Byte;
    barCode.Options.QRCode.ErrorLevel = QRCodeErrorLevel.Q;
    barCode.Options.QRCode.ShowCodeText = false;
    barCode.DpiX = 72;
    barCode.DpiY = 72;
    barCode.Module = 2f;

    // Save the barcode as an image.
    barCode.Save("BarCodeImage.png", DXImageFormat.Png);
    // Open the image in the default viewer.
    Process.Start(new ProcessStartInfo("BarCodeImage.png") { UseShellExecute = true });
}
See Also