Skip to main content
All docs
V25.1
  • QRCodeOptions.FrameOptions Property

    Gets or sets the frame for QR codes.

    Namespace: DevExpress.BarCodes

    Assembly: DevExpress.Docs.v25.1.dll

    NuGet Package: DevExpress.Document.Processor

    Declaration

    public QRFrameOptions FrameOptions { get; set; }

    Property Value

    Type Description
    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 Type Path 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:

    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 });
    

    The resulting frame looks as follows:

    QR Code with Frame

    See Also