QR Code
- 3 minutes to read
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.
Examples
Configure Barcode Settings (QRCodeOptions)
Use the QRCodeOptions class to configure QRCode settings.
The following code snippet creates a QR Code barcode and specifies its settings:

using DevExpress.Docs.Barcode;
using DevExpress.Drawing;
using System.Drawing;
using var fileStream = new FileStream("logo.png", FileMode.Open);
var qrOptions = new QRCodeOptions();
qrOptions.ErrorCorrectionLevel = QRCodeErrorCorrectionLevel.H;
qrOptions.CompactionMode = QRCodeCompactionMode.Auto;
qrOptions.IncludeQuietZone = false;
qrOptions.Logo = DXImage.FromStream(fileStream);
qrOptions.Version = QRCodeVersion.Version10;
qrOptions.ModuleSize = 40;
qrOptions.BackColor = Color.LightGray;
qrOptions.ShowText = false;
qrOptions.Padding = new Padding(5);
qrOptions.BorderWidth = 1;
qrOptions.BorderColor = Color.Blue;
using var qrOptionsStream = new FileStream(Path.Combine(outDir, "barcode_symbology_qr_code.png"), FileMode.Create, FileAccess.Write);
using var qrOptionsGenerator = new BarcodeGenerator(qrOptions);
qrOptionsGenerator.Export("https://www.devexpress.com", qrOptionsStream, DXImageFormat.Png);
Configure Barcode Settings (Fluent API)
Use the QRCodeOptionsBuilder class to configure QRCode settings with Fluent API.
The following code snippet creates a QR Code barcode and specifies its settings:

using DevExpress.Docs.Barcode;
using DevExpress.Drawing;
using System.Drawing;
using var fileStream = new FileStream("logo.png", FileMode.Open);
var qrcode = QRCodeOptionsBuilder.Create()
.WithErrorCorrectionLevel(QRCodeErrorCorrectionLevel.H)
.WithCompactionMode(QRCodeCompactionMode.Auto)
.WithIncludeQuietZone(true)
.WithLogo(DXImage.FromStream(fileStream))
.WithVersion(QRCodeVersion.Version10)
.WithModuleSize(40)
.WithBackColor(Color.LightGray)
.WithShowText(false)
.WithPadding(5)
.WithBorderWidth(1)
.WithBorderColor(Color.Blue)
.Build();
var filePath = Path.GetFullPath("qrcode.png");
using var stream = new FileStream(filePath, FileMode.Create);
using var generator = new BarcodeGenerator(qrcode);
generator.Export("https://www.devexpress.com", stream, DXImageFormat.Png);
Symbology-Specific Options
| Property | Description |
|---|---|
| CompactionMode | Gets or sets the compaction mode for the QR code. |
| ErrorCorrectionLevel | Gets or sets the error correction level for the QR code. |
| FrameOptions | Specifies frame options for the QR code. |
| IncludeQuietZone | Specifies whether to include a quiet zone (a margin of empty space) around the code. |
| Logo | Gets or sets the logo image of the QR code. |
| Version | Gets or sets the QR code version. |
See Also