BarcodeDrawingOptions Class

Options for drawing a barcode on a DrawingCanvas.

public sealed class BarcodeDrawingOptions

Remarks

The sizes are in the units of the canvas: pixels, unless a transform is applied.

Constructors

NameDescription
BarcodeDrawingOptions()

BarcodeDrawingOptions()

BarcodeDrawingOptions.cs
public BarcodeDrawingOptions()

No documentation is available.

Properties

NameDescription
DarkBrushGets or sets the brush of the bars. Default is a black SolidBrush.
FontGets or sets the font of the human-readable text (Barcode.Text) printed under the bars. Default is null: no text.
FontSizeGets or sets the size of the font, in units per em. Default is 14.
LightBrushGets or sets the brush of the spaces, of the quiet zone and of the background of the text. Default is a white SolidBrush.
ModuleHeightGets or sets the height of each module, which is the height of the bars. Default is 80.
ModuleWidthGets or sets the width of each module. Default is 2.
QuietZoneModulesGets or sets the number of quiet zone modules on the left and right sides of the barcode. Default is 10.
SnapToPixelsGets or sets a value indicating whether the module sizes and the positions are rounded to whole units. Default is true.
TextBrushGets or sets the brush of the text. Default is null: the text is painted with BarcodeDrawingOptions.DarkBrush.
TextSpacingGets or sets the space between the bottom of the bars and the top of the text. Default is 2.

Gets or sets the brush of the bars. Default is a black SolidBrush.

public Brush DarkBrush { get; set; }

Property value

Brush

Remarks

The brush is in the coordinates of the canvas: a gradient spans the canvas, not the barcode.

Gets or sets the font of the human-readable text (Barcode.Text) printed under the bars. Default is null: no text.

public Font? Font { get; set; }

Property value

Font?

Remarks

BarcodeFonts.OcrB is the font usually printed under EAN and UPC barcodes.

Gets or sets the size of the font, in units per em. Default is 14.

public double FontSize { get; set; }

Property value

double

Gets or sets the brush of the spaces, of the quiet zone and of the background of the text. Default is a white SolidBrush.

public Brush? LightBrush { get; set; }

Property value

Brush?

Remarks

null leaves the pixels under the spaces, the quiet zone and the text unchanged.

Gets or sets the height of each module, which is the height of the bars. Default is 80.

public double ModuleHeight { get; set; }

Property value

double

Gets or sets the width of each module. Default is 2.

public double ModuleWidth { get; set; }

Property value

double

QuietZoneModules

BarcodeDrawingOptions.cs

Gets or sets the number of quiet zone modules on the left and right sides of the barcode. Default is 10.

public int QuietZoneModules { get; set; }

Property value

int

Gets or sets a value indicating whether the module sizes and the positions are rounded to whole units. Default is true.

public bool SnapToPixels { get; set; }

Property value

bool

Remarks

Rounding gives every bar of one width the same width and sharp edges, which scanners read best. The module sizes round to the nearest whole number, at least 1. Set false to draw at the exact sizes and position.

Gets or sets the brush of the text. Default is null: the text is painted with BarcodeDrawingOptions.DarkBrush.

public Brush? TextBrush { get; set; }

Property value

Brush?

Gets or sets the space between the bottom of the bars and the top of the text. Default is 2.

public double TextSpacing { get; set; }

Property value

double