Skip to main content

BarCode.Module Property

Gets or sets the width of the narrowest bar or space in the bar code.

Namespace: DevExpress.BarCodes

Assembly: DevExpress.Docs.v23.2.dll

NuGet Package: DevExpress.Document.Processor

Declaration

public double Module { get; set; }

Property Value

Type Description
Double

A Double value which represents the width of the narrowest bar or space.

Remarks

The Module property cannot be set to a value less than or equal to 0.

Note that if the Module property is set to a very small value, a bar code image may be unreadable by a scanner.

The code sample below creates a QR code and displays it in a PictureBox.

using System;
using System.Text;
using DevExpress.BarCodes;
using DevExpress.Drawing;
using DevExpress.Drawing.Extensions;
//...

private void button1_Click(object sender, EventArgs e)
{
    this.pictureBox1.Image = null;

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

    this.pictureBox1.Image = barCode.BarCodeImage.ConvertToGdiPlusImage();
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Module property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also