VB.NET Data Matrix Generator Size Setting Tutorial

sample source code to generate 2D Data Matrix images and adjust barcode size in VB.NET

  • Generate flexible Data Matrix barcode images in VB.NET
  • Support data mode ASCII, C40, Text, X12, Edifact, Base256
  • Process tilde to specify special characters in the input data
  • Print high quality GIF, TIFF, BMP, PNG, and JPEG images
  • Easy to set the size of cell
  • Print square Data Matrix
  • Also draw rectangular Data Matrix
  • Ready to be used in windows forms and web forms
  • Compatible with ISO / IEC 16022 (2nd edition 2007-05-15)

Data Matrix, also known as Data Matrix ECC200, is great 2-dimensional matrix barcode to store different data up to 2,335 alphanumeric characters.


Data Matrix Symbology Structure

X (X ≥ 1 pixel): the width of a cell, controlled by property X

Q (Q ≥ 10X): the width of the quiet zone, related to property LeftMargin & RightMargin

Data regions: consisting of square modules set out in a regular array

Finder pattern: two solid adjacent borders in an "L" shape (width=X)

Timing pattern: other two borders consisting of alternating dark and light modules

Alignment pattern: for larger symbols (start with 32x32) to separate data regions (=2X)

More information about Data Matrix barcode settings in VB.NET Barcode Generator,please see:


Data Matrix VB.NET Generator Size Setting Tutorial

After Data Matrix VB.NET Generator installation, get it ready in VB.NET by placing the following statement:

Dim datamatrix As OnBarcode.Barcode. DataMatrix

datamatrix = New OnBarcode.Barcode. DataMatrix


The number of modules of a Data Matrix is controlled by Property FormatMode (Default: Format_10X10) . "FM_10X10" stands for the quantity of modules in X dimension is 10, and that in Y dimension is 10.

Sample usage:

datamatrix.FormatMode = OnBarcode.Barcode.DataMatrixFormatMode.Format_12X12


UOM is the controller of size setting unit. Pixel, Cm, and Inch are provided as its options. The default value of UOM is Pixel. For example, type the following statement to select Pixel as the unit of size setting measure:

Sample usage:

datamatrix.UOM = OnBarcode.Barcode.UnitOfMeasure.PIXEL


Property X (Type: Float; Default: 1) is used for the module width and height setting.

Sample usage:

datamatrix.X = 2

BarCodeHeight & BarCodeWidth

Property BarCodeHeight (Type: Float; Default: 0) and Property BarCodeWidth (Type: Float; Default: 0) to set the size of the whole image.

Sample usage:

datamatrix.BarcodeHeight = 175

datamatrix.BarcodeWidth = 175


When the value of X, BarCodeWidth, and BarCodeHeight conflict with each other, Property AutoResize (Type: bool; Default: False) should be enabled to solve the problem and make the Data Matrix 100% compatible with its symbology specification and ISO 16022. See Data Matrix Barcode Size in VB.NET to know more usage of AutoResize.

Sample usage:

datamatrix.X = 2

datamatrix.BarcodeHeight = 60

datamatrix.AutoResize = True

TopMargin, BottomMargin, LeftMargin, & RightMargin

Using Data Matrix VB.NET Generator, a quiet zone with 10X width will be generated automatically at each side of the Data Matrix. When wider quiet zone is needed, you can increase the value of properties LeftMargin (Type: Float; Default: 0) and RightMargin (Type: Float; Default: 0). You can also create margins using TopMargin (Type: Float; Default: 0) and BottomMargin (Type: Float; Default: 0).

Sample usage:

datamatrix.TopMargin = 10

datamatrix.BottomMargin = 10

datamatrix.LeftMargin = 10

datamatrix.RightMargin = 10

OnBarcode is a market-leading provider of barcode generator, reader controls and components for ASP.NET, Windows Forms, WPF, as well Java, Android, iOS (iPhone, iPad) across all major enterprise development platforms. We provides high quality tutorials and guides for various linear, 2d barcode information, such as C# Barcode, QR Code C#, QR Code VB.NET, QR Code ASP.NET, QR Code .NET, ASP.NET Barcode. OnBarcode barcode products are supported by RasterEdge .NET HTML5 Document Viewer high quality C# Convert PDF to Tiff, C# Convert PDF to Word, C# Convert PDF to HTML, C# Convert PDF to Jpeg images, and their easy and simple documents, like C# PDF SDK, C# extract text from PDF, C# Compress PDF, Print PDF in C# and C# extract image from PDF.
Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.