corelibraries-devexpress-dot-xtraprinting-dot-barcode-dot-qrcodegenerator-1793df67.md
Specifies the image that overlays the QR code.
Namespace : DevExpress.XtraPrinting.BarCode
Assembly : DevExpress.Printing.v25.2.Core.dll
NuGet Package : DevExpress.Printing.Core
[DefaultValue(null)]
public ImageSource Logo { get; set; }
<DefaultValue(Nothing)>
Public Property Logo As ImageSource
| Type | Default | Description |
|---|---|---|
| ImageSource | null |
The image to be displayed on the QR code.
|
Use this property to specify an image for a QR code. For example, guidelines on Swiss bill reports demand that a QR code has a Swiss cross logo. The Create a Swiss QR Bill topic explains how to set up a QR code for a Swiss QR-bill report.
You can assign images of the following formats: BMP, JPG, JPEG, GIF, TIF, TIFF, PNG, ICO, DIB, RLE, JPE, JFIF, EMF, WMF, SVG.
Note
The Logo property is ignored when the AutoModule property is enabled.
If the Logo property is specified, the QRCodeGenerator.ErrorCorrectionLevel enumeration values are halved. The code below demonstrates how to set this property to an SVG image in code:
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Windows.Forms;
using DevExpress.XtraPrinting.BarCode;
using DevExpress.XtraPrinting.Drawing;
using DevExpress.XtraReports.UI;
// ...
public XRBarCode CreateQRCode(string BarCodeText) {
// Create a bar code control.
XRBarCode barCode = new XRBarCode();
// Set the bar code's type to QRCode.
barCode.Symbology = new QRCodeGenerator();
barCode.ShowText = false;
barCode.Width = 470;
barCode.Height = 470;
barCode.Module = 4.07F;
// Adjust the properties specific to the bar code type.
((QRCodeGenerator)barCode.Symbology).CompactionMode = QRCodeCompactionMode.Byte;
((QRCodeGenerator)barCode.Symbology).ErrorCorrectionLevel = QRCodeErrorCorrectionLevel.M;
((QRCodeGenerator)barCode.Symbology).Version = QRCodeVersion.Version24;
((QRCodeGenerator)barCode.Symbology).Logo = ImageSource.FromFile(@"..\..\CH-Kreuz_7mm.svg");
return barCode;
}
Imports System
Imports System.Collections.Generic
Imports System.Drawing.Printing
Imports System.Windows.Forms
Imports DevExpress.XtraPrinting.BarCode
Imports DevExpress.XtraPrinting.Drawing
Imports DevExpress.XtraReports.UI
' ...
Public Function CreateQRCode(ByVal BarCodeText As String) As XRBarCode
' Create a bar code control.
Dim barCode As New XRBarCode()
' Set the bar code's type to QRCode.
barCode.Symbology = New QRCodeGenerator()
barCode.ShowText = False
barCode.Width = 470
barCode.Height = 470
barCode.Module = 4.07F
' Adjust the properties specific to the bar code type.
CType(barCode.Symbology, QRCodeGenerator).CompactionMode = QRCodeCompactionMode.Byte
CType(barCode.Symbology, QRCodeGenerator).ErrorCorrectionLevel = QRCodeErrorCorrectionLevel.M
CType(barCode.Symbology, QRCodeGenerator).Version = QRCodeVersion.Version24
CType(barCode.Symbology, QRCodeGenerator).Logo = ImageSource.FromFile("..\..\CH-Kreuz_7mm.svg")
Return barCode
End Function
See Also