Search Results for

    Show / Hide Table of Contents

    Class QrStyleOptions

    Creates the styling options for a QR code, including dimensions, margins, color, background color, annotations, and logo.

    Inheritance
    System.Object
    QrStyleOptions
    Namespace: IronQr
    Assembly: IronQr.dll
    Syntax
    public sealed class QrStyleOptions : ValueType

    The visual styling of a generated QR code, covering size, margins, colors, and an embedded logo, is set through QrStyleOptions. It is passed to QrCode.Save, so a code produced by QrWriter is styled at the moment it becomes an image. Construct one with the object initializer or the parameterized constructor that takes dimensions, margins, and colors.

    The properties group by concern. Size is Dimensions, the pixel width and height of the square image. Spacing is the convenience Margins, which sets every side at once, or the per-side MarginTop, MarginRight, MarginBottom, and MarginLeft for asymmetric quiet zones. Color is Color for the modules and BackgroundColor for the field behind them, both System.Drawing.Color values. Branding is Logo, a Nullable<QrLogo> that embeds an image in the center of the code.

    The parameterless constructor starts from sensible defaults, a 300-pixel code with a small uniform margin, so only the properties that differ from the default need to be set. The per-side margins are useful when a code sits in a layout that needs a wider quiet zone on one edge, for instance against a page border or next to other content.

    Two pairings matter in practice. A logo covers part of the symbol, so raise the QrErrorCorrectionLevel on the QrOptions used to write the code, which keeps it scannable. Custom colors need enough contrast between Color and BackgroundColor for scanners to read reliably, so avoid light-on-light combinations.

    var style = new QrStyleOptions
    {
        Dimensions = 400,
        Color = Color.DarkBlue,
        Logo = new QrLogo(logoBitmap, 80, 80)
    };
    qr.Save(style);

    The styled QR example applies a full style, the custom logo how-to embeds a logo, and the custom colors how-to covers contrast.

    Constructors

    QrStyleOptions()

    Initializes a new instance of the QrStyleOptions struct with default values.

    Declaration
    public QrStyleOptions()

    QrStyleOptions(Int32, Int32, Color, Color, Nullable<QrLogo>)

    Initializes a new instance of the QrStyleOptions struct with specified values.

    Declaration
    public QrStyleOptions(int dimensions = 300, int margins = 10, Color color = null, Color backgroundColor = null, Nullable<QrLogo> logo = null)
    Parameters
    Type Name Description
    System.Int32 dimensions

    The width and height of the QR code in pixels. Defaults to 300.

    System.Int32 margins

    The whitespace margins around the QR code. Defaults to 10.

    IronSoftware.Drawing.Color color

    The color of the QR code's content. Defaults to black.

    IronSoftware.Drawing.Color backgroundColor

    The background color of the QR code. Defaults to white.

    System.Nullable<QrLogo> logo

    An optional logo to be embedded within the QR code.

    Properties

    BackgroundColor

    Specifies the background color of the QR code.

    Declaration
    public Color BackgroundColor { get; set; }
    Property Value
    Type Description
    IronSoftware.Drawing.Color

    Color

    Specifies the color of the QR code's content.

    Declaration
    public Color Color { get; set; }
    Property Value
    Type Description
    IronSoftware.Drawing.Color

    Dimensions

    The width and height of the QR code in pixels.

    Declaration
    public int Dimensions { get; set; }
    Property Value
    Type Description
    System.Int32

    Logo

    Specifies an optional logo to be embedded within the QR code.

    Declaration
    public Nullable<QrLogo> Logo { get; set; }
    Property Value
    Type Description
    System.Nullable<QrLogo>

    MarginBottom

    Specifies the amount of whitespace or padding at the bottom of the QR code.

    Declaration
    public int MarginBottom { get; set; }
    Property Value
    Type Description
    System.Int32

    MarginLeft

    Specifies the amount of whitespace or padding at the left of the QR code.

    Declaration
    public int MarginLeft { get; set; }
    Property Value
    Type Description
    System.Int32

    MarginRight

    Specifies the amount of whitespace or padding at the right of the QR code.

    Declaration
    public int MarginRight { get; set; }
    Property Value
    Type Description
    System.Int32

    Margins

    Sets the whitespace margins around the QR code, applying the same value to the top, bottom, left, and right.

    Declaration
    public int Margins { set; }
    Property Value
    Type Description
    System.Int32

    MarginTop

    Specifies the amount of whitespace or padding at the top of the QR code.

    Declaration
    public int MarginTop { get; set; }
    Property Value
    Type Description
    System.Int32
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with NuGet
    IronQR_for_dotnet_log2o
    Blue key in circleGet started for FREE
    No credit card required
    Test in a live environment

    Test in production without watermarks.
    Works wherever you need it to.

    Fully-functional product

    Get 30 days of fully functional product.
    Have it up and running in minutes.

    24/5 technical support

    Full access to our support engineering team during your product trial

    Grey key in circleGet started for FREE
    The trial form was submitted successfully.
    Calendar in circleBook Free Live Demo
    No contact, no card details, no commitments Book a 30-minute, personal demo.
    Here's what to expect:

    A live demo of our product and its key features

    Get project specific feature recommendations

    All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)

    Grey key in circleBook Free Live Demo
    Your booking has been completed Check your e-mail for confirmation
    Support Team Member 6 related to The C# PDF Library Support Team Member 14 related to The C# PDF Library Support Team Member 4 related to The C# PDF Library Support Team Member 2 related to The C# PDF Library
    Online 24/5
    Need help? Our sales team would be glad to help you.
    Try the Enterprise Trial
    ironpdf_for_dotnet_log2o
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    bullet_checkedNo credit card or account creation required
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    Blue key in circleNo credit card or account creation required
    Green Check in orange circle
    The trial form was submitted successfully.
    badge_greencheck_in_yellowcircle
    Thank you for starting a trial

    Please check your email for the trial license key.

    If you don’t receive an email, please start a live chat or email support@ironsoftware.com

    Install with NuGet
    View Licensing
    • Logo Aetna
    • Logo NASA
    • Logo GE
    • Logo Porsche
    • Logo USDA
    • Logo Qatar
    Join Millions of Engineers who’ve tried IronQR