KA.Barcode for .NET WinForms
How to Generate Data Matrix Image in .NET WinForms
Source code to generate Data Matrix in different image formats using Barcode for .NET WinForms
  • Easy integration into Microsoft VS.NET for Data Matrix generation
  • Easy to add Data Matrix barcode functions & features to .NET Framework
  • Draw and export high-quality .NET Intelligent Mail, .NET QR Code, ISBN .NET WinForms barcodes as you wish
  • Provide complete tutorials for Data Matrix data encoding in C#, VB.NET class library
  • Encode all ASCII characters into Data Matrix with dynamic data modes
  • Accurate Data Matrix generation complying with ISO / IEC 16022 (2nd edition 2006-09-15)
  • Support creating multiple GS1 system compatible Data Matrix
  • Dynamic barcode components, such as barcode Word & barcode .NET, are provided
  • Generate Data Matrix graphics and save to local files in Png, Jpeg/Jpg, Gif, Tiff, Bmp/bitmap formats
  • Professional, mature 2D Data Matrix barcode generating component use word-wide
Data Matrix Barcode Maker for .NET WinForms is a light weight barcode generating addin SDK device written in C#, it integrates perfectly with MS Visual Studio and other .NET development environments to make, print Data Matrix ECC200 and other 20+ linear & 2d barcode symbologies in .NET windows forms, Crystal Reports, C#, VB.NET class, etc.
This is guide for customizing Data Matrix barcode image in .NET Winforms, others please see:
Install Data Matrix Barcode Maker into .NET WinForms
  1. 1.
  2. 2.
    Add reference: Add "KeepAutomation.Barcode.Windows.dll" to your .NET Winforms project reference
  3. 3.
    Add to toolbox: To add BarcodeControl to your .NET Winforms toolbox
Data Matrix Image Setting with Drag & Drop BarcodeControl
  1. 1.
    In "Choose Toolbox Items" form, click button "Browse...", and select KeepAutomation.Barcode.Windows.dll
  2. 2.
    Now you will see BarCodeControl in your toolbox
  3. 3.
    Drag and drop the BarCodeControl into the Forms and a Codabar image is generated
  4. 4.
    Find barcode setting panel in the left side and change barcode symbology into Data Matrix
  5. 5.
    Now you can customize the following setting

Data Matrix Barcode Unit

Three units of measures are provided for your Data Matrix generation, which includes cm, inch and pixel. Default value is pixel. You can customize this parameter by changing the Bar Code Unit.

Data Matrix X Dimension & Y Dimension

X dimension, the module bar width, is a primary parameter for barcode which stands for the width of the narrowest bar, while Y dimension is the height of the module bar. Since Data Matrix is made up tiny black module squares, you are supposed to set X and Y to the same value.

Data Matrix Barcode Margins

Margins are called quiet zones in the barcode specification. The ISO/IEC 16022 specification for Data Matrix requires margins on four sides of a Data Matrix image with the same value of X dimension. For example, if you set X to 3 pixel, then you copy the demo code below.

Data Matrix Image Formats

KA.Barcode Generator for .NET Suite supports printing and saving Data Matrix barcodes in different image formats, including Png, Jpeg/Jpg, Gif, Tiff, Bmp, etc.

Data Matrix Format Mode

KA.Barcode Generator for .NET Suite supports 40 types of Data Matrix format modes, and the supported formats vary from 10x10 to 144x144. Copy the C# sample code below to adjust it.

Data Matrix Image Orientation

If you want to rotate a Data Matrix bar code image to change position, you can find in the control panel the Orientation parameter and change it into: 0 degree, 90 degrees, 180 degrees, or 270 degrees.

Data Matrix Barcode Unit

KA.Barcode Generator for .NET Suite provides three units of measure for Data Matrix image generation: Pixel, Cm and Inch.
The default value is Pixel. Copy the demo code below to customize this parameter.

Data Matrix Image Resolution

KA.Barcode Generator for .NET WinForms provides resolution option for users to adjust. Default value is 72 DPI. Make necessary change to output high-quality Data Matrix barcode images.
Data Matrix Image Setting in C#.NET and VB.NET Class Library
Copy the C#, VB.NET sample codings below to make, display high-quality Data Matrix barcode in WinForms:
using KeepAutomation.Barcode.Bean;
BarCode datamatrix= new BarCode();
datamatrix. Symbology = Symbology. DataMatrix;
datamatrix.CodeToEncode = "C#DataMatrixImage";
datamatrix.X = 3;
datamatrix.Y = 3;
datamatrix.LeftMargin = 3;
datamatrix.RightMargin = 3;
datamatrix.TopMargin = 3;
datamatrix.BottomMargin = 3;
datamatrix.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
datamatrix.BarcodeUnit = BarcodeUnit.Pixel;
datamatrix.DPI = 72;
datamatrix.Orientation = KeepAutomation.Barcode.Orientation .Degree90;
datamatrix.DataMatrixFormatMode = DataMatrixFormatMode.FM_12X12;
datamatrix.generateBarcodeToImageFile("C:/datamatrix_csharp.png");
Dim datamatrix As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode

datamatrix.Symbology = KeepAutomation.Barcode.Symbology.DataMatrix
datamatrix.X = 3
datamatrix.Y = 3
datamatrix.CodeToEncode = "VBDataMatrixImage"
datamatrix.LeftMargin = 3
datamatrix.RightMargin = 3
datamatrix.TopMargin = 3
datamatrix.BottomMargin = 3
datamatrix.DPI = 72
datamatrix.Orientation = KeepAutomation.Barcode.Orientation.Degree90
datamatrix.ImageFormat = System.Drawing.Imaging.ImageFormat.Png()
datamatrix.DataMatrixFormatMode = KeepAutomation.Barcode.DataMatrixFormatMode.FM_12X12
datamatrix.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel
datamatrix.generateBarcodeToImageFile("C:/ datamatrix _vb.png")