Back to Devexpress

QRCodeOptions.FrameOptions Property

officefileapi-devexpress-dot-barcodes-dot-qrcodeoptions-48fb2a04.md

latest4.9 KB
Original Source

QRCodeOptions.FrameOptions Property

Gets or sets the frame for QR codes.

Namespace : DevExpress.BarCodes

Assembly : DevExpress.Docs.v25.2.dll

NuGet Package : DevExpress.Document.Processor

Declaration

csharp
public QRFrameOptions FrameOptions { get; set; }
vb
Public Property FrameOptions As QRFrameOptions

Property Value

TypeDescription
QRFrameOptions

A QRFrameOptions object that contains options used to configure the frame for QR codes.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to FrameOptions
BarCodeOptions

.QRCode .FrameOptions

|

Remarks

QR Code, GS1 QR Code, and EPC QR Code support the following frames:

To add a new frame, select one of the frame types and assign its new instance to the QR code’s FrameOptions property:

csharp
using DevExpress.BarCodes;
using DevExpress.Drawing;
using DevExpress.XtraPrinting.BarCode;
using System.Diagnostics;
using System.Drawing;
using System.Text;

// 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 = DevExpress.BarCodes.QRCodeCompactionMode.Byte;
barCode.Options.QRCode.ErrorLevel = QRCodeErrorLevel.Q;
barCode.Options.QRCode.ShowCodeText = false;
barCode.DpiX = 72;
barCode.DpiY = 72;
barCode.Module = 2f;

//Specify the frame settings.
RectangleQRFrameOptions frameOpt = new RectangleQRFrameOptions() {
    FrameWidth = 4,
    FrameColor = System.Drawing.Color.DarkRed,
    Text = "Scan me",
    TextAlignment = QRFrameTextAlignment.Baseline,
    TextPosition = QRFrameTextPosition.Top,
    CornerRadius = 5
};
barCode.Options.QRCode.FrameOptions = frameOpt;

// 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 });
vb
IImports DevExpress.BarCodes
Imports DevExpress.Drawing
Imports DevExpress.XtraPrinting.BarCode
Imports System.Diagnostics
Imports System.Drawing
Imports System.Text

' Create a QR code.
Private barCode As 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 = DevExpress.BarCodes.QRCodeCompactionMode.Byte
barCode.Options.QRCode.ErrorLevel = QRCodeErrorLevel.Q
barCode.Options.QRCode.ShowCodeText = False
barCode.DpiX = 72
barCode.DpiY = 72
barCode.Module = 2F

'Specify the frame settings.
Dim frameOpt As New RectangleQRFrameOptions() With {
    .FrameWidth = 4,
    .FrameColor = System.Drawing.Color.DarkRed,
    .Text = "Scan me",
    .TextAlignment = QRFrameTextAlignment.Baseline,
    .TextPosition = QRFrameTextPosition.Top,
    .CornerRadius = 5
}
barCode.Options.QRCode.FrameOptions = frameOpt

' 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") With {.UseShellExecute = True})

The resulting frame looks as follows:

See Also

QRCodeOptions Class

QRCodeOptions Members

DevExpress.BarCodes Namespace