Our Customers
Contact Us Email: support@barcodelib.com
Home > .NET WinForms Barcode> .NET Windows Forms Barcode Generator Guide> .NET WinForms Barcode Generation Guide in C#
Download Barcode for .NET WinForms Trial

How to Generate Barcode in .NET WinForms using C#

Barcode for .NET WinForms - How to Generate Windows Forms Project Barcode Images in Visual C#
  • Advanced barcode generator software for .NET Windows Forms in the market
  • Completely design for C# barcode generation project programmers
  • Simply generate and make barcodes in Visual Studio C# windows applications
  • Generate high print-quality C# barcode images by dragging the control to a windows form
  • Support main 2d/matrix barcode generation in C#.NET Windows Forms application: Data Matrix, PDF417, and QR Code
  • Support main 1d/linear barcode creation in C#.NET Windows Forms application: Code 39, Code 128, EAN-13,
    GS1-128, Interleaved 2 of 5, ITF-14, UPC-A, UPC-E barcodes and so on
Prerequisites for .NET WinForms VB.NET Barcode Generation
  • BarcodeLib.Barcode.WinForms.dll
  • .NET Framework 2.0 or greater
  • Visual Studio .NET 2005 or later versions
Generate Barcode Image .NET WinForms in C# Class


  1. Create your barcoding project in Microsoft Visual Studio.
  2. Click "Project" and select "Add Reference...".
  3. In the pop-up window, click "Browse" to add "BarcodeLib.Barcode.WinForms.dll" to project reference.


  1. When the barcode control dll is added to reference, you can copy the Visual C# sample code to your syntax for a barcode printing test.
     BarcodeLib.Barcode.Linear barcode = new BarcodeLib.Barcode.Linear();
barcode.Type = BarcodeType.CODE39;
barcode.Data = "CODE39";
barcode. UOM = BarcodeLib.Barcode.UnitOfMeasure.PIXEL;
barcode.BarWidth = 1;
barcode.BarHeight = 80;
barcode.LeftMargin = 5;
barcode.RightMargin = 5;
barcode.TopMargin = 5;
barcode.BottomMargin = 5;

barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

// save barcode image into your file system

// generate barcode & output to byte array
byte[] barcodeInBytes = barcode.drawBarcodeAsBytes();

// generate barcode to Graphics object
Graphics graphics = ...

// generate barcode and output to Bitmap object
Bitmap barcodeInBitmap = barcode.drawBarcode();

// generate barcode and output to HttpResponse object
HttpResponse response = ...;

// generate barcode and output to Stream object
Stream stream = ...;
Create Barcode Images through C# Windows Form Controller
  1. Add Reference "BarcodeLib.Barcode.WinForms.dll" to your barcode generating project.
  2. Add the barcode component library to your Visual Studio toolbox.
    • Click "View" in Visual Studio and check "Toolbox".
    • Right click in Toolbox to select "Choose Items...".
    • Click "Browse" to find the "BarcodeLib.Barcode.WinForms.dll" from the unzipped evaluation package, and click "Ok".
    • Now you will find four items that have been added to the Toolbox.

    • According to the barcode types you need, you can simply drag the corresponding barcode control to your form for dynamic barcode painting.
      Please pay attention that "LinearWinForm" component supports various 1D barcode types, from which you can select in the right-side properties table.
.NET Windows Forms Barcode Generator DLL Supported Barcodes
  • .NET Linear Barcodes for Windows Forms
    Generate 1D Barcodes:

  • .NET 2D Barcodes for Windows Forms
    Generate 2D Barcodes:

Other Related .NET Barcode Generation DLLs