Home  >  .NET WinForms Barcode Generator  >  Use .NET Windows Forms Barcode DLL to Create Barcode Images
.NET Windows Forms Barcode Tutorial
.NET Windows Forms Barcode Control is a professional and easy-to-use barcode generator for any .NET development environments that are compatible with customizing WinForms DLL or Control. It supports Visual C#, Visual Basic, Managed C++, Borland Delphi for .NET and Visual Studio 2005/2008/2010. This smart barcode control export barcodes as graphic images, instead of fonts, to a barcode printer or an image file.

Unlike common barcode fonts, this barcode generationg control calculates checksum digits automatically while creating barcodes in .NET Windows Forms applications. And you are also allowed to change the barcode size and many other barcode properties as your specific requirements using this .NET WinForms barcoding control. It supports creating over 20 most common linear and two dimensional barcode symbologies.
.NET Windows Forms Barcode Generator Control & DLL supports generating most common linear (1d) and matrix (2d) bar code standards, including:
The following article shows you how to generate barcodes in Window Forms applications in Visual Studio by using our barcode tool.
Tutorial - Install .NET WinForms Barcoding SDK into Visual Studio
  1. Download the Barcode SDK for .NET Windows Forms from the right top Down link
  2. Extract the barcode files from the package and Copy the KeepDynamic.BarCode.Windows.dll file to your project directory. The .NET build tools will automatically put the barcode DLL file into an appropriate bin directory
  3. Start your Visual Studio and open the project/solution that you are going to add barcode generating features
  4. Display the form where barcodes will be created and right click the Toolbox, select Choose Items
  5. Select .NET Framework Components, Hit Browse at the right lower side of the Window
  6. Choose the KeepDynamic.BarCode.Windows.dll file under the project directory
  7. Then four barcode items will appear in your Toolbox. They are BarCodeControl, QRCodeControl, DataMatrixControl, and PDF417Control
  8. In addition, you can also install the barcode tool via selecting Project: Add Reference
How to Create Barcodes in Windows Forms Applications?
To create linear & 2D barcodes in Windows Forms applications, do the following procedures:
  1. Add KeepDynamic.BarCode.Windows.dll to your C#, VB.NET project reference.
  2. Add KeepDynamic.BarCode.Windows.dll to windows project toolbox.
  3. Drag one of the BarCodeControl, DataMatrixControl, PDF417Control, QRCodeControl item to your windows forms. To generate linear barcode symbologies, such as Code 3 of 9, Code 128, GS1-128, UPC/EAN as well as IM barcode, Postnet, RM4SCC, please drag and drop the tool BarCodeControl to your .NET WinForms Project. To create matrix(2D) barcodes, like QR Code, Data Matrix and PDF417, please drag and drop the corresponding barcode control( QRCodeControl, DataMatrixControl, and PDF417Control) to your .NET project.
How to Generate Barcodes in WinForms using C# Class
The following C# .NET code illustrates how to generate a barcode in C# class:
// Create linear barcode object in C#
BarCode barcode = new BarCode();

// Set barcode symbology type to Code-39 in C#
barcode.SymbologyType = SymbologyType.Code39;

// Set Code39 barcode value in C#
barcode.CodeText = "CODE39";

// Set Code39 drawing image format to PNG in C#
barcode.Format = System.Drawing.Imaging.ImageFormat.Png;

// Generate Code-39 barcode & encode to the png image in C#
barcode.drawBarcode("C://barcode-code39-csharp.png");

// other barcode outputting ways: // output generated barcode to byte array byte[] barcodeInBytes = barcode.drawBarcodeAsBytes(); // output generated barcode to Graphics object Graphics graphics = ... barcode.drawBarcode(graphics); // output generated barcode to Bitmap object Bitmap barcodeInBitmap = barcode.drawBarcode(); // draw created barcode to HttpResponse object HttpResponse response = ...; barcode.drawBarcode(response); // save generated barcode images to Stream object Stream stream = ...; barcode.drawBarcode(stream);
How to Create Barcodes in WinForms using VB.NET Class
The following VB.NET code illustrates how to generate a barcode in VB.NET class:
' Create linear barcode object in VB.NET
Dim barcode As New BarCode()

' Set barcode symbology type to Code-39 in VB.NET
barcode.SymbologyType = SymbologyType.Code39

' Set Code39 barcode value in VB.NET
barcode.CodeText = "CODE39"

' Set Code39 drawing image format to PNG in VB.NET
barcode.Format = System.Drawing.Imaging.ImageFormat.Png

' Generate Code-39 barcode & encode to the png image in VB.NET
barcode.drawBarcode("C://barcode-code39-vbnet.png")

' other barcode outputting ways:
' to byte array
byte[] barcodeInBytes = barcode.drawBarcodeAsBytes()
   
' output generated barcode to Graphics object
Graphics graphics = ...
barcode.drawBarcode(graphics)
    
' output generated barcode to Bitmap object
Bitmap barcodeInBitmap = barcode.drawBarcode()
    
' draw created barcode to HttpResponse object
HttpResponse response = ...
barcode.drawBarcode(response)
    
' save generated barcode images to Stream object
Stream stream = ...
barcode.drawBarcode(stream)
How to Change Barcode Size as Desired Requirements
Although default barcode size values are given while generating barcode, you can change the barcode size values from the barcode properties in the Properties window or using C# or VB.NET class codes. For example, if you want to generate a barcode type with a fixed bar width and image height,you can change the values of Width and Height under Size properties.
How to Change Barcode Properties as Specified Requirements
In addition to barcode size properties, many more barcode property options are listed in the control property board for easy operating. Each property has its own default values that are strongly recommended by KeepDynamic for generating high quality barcode image. For detailed barcode properties, please refer to the barcode type symbology properties page.