Java Barcode Generator, .NET Barcode Generator for C#, ASP.NET, VB.NET
HOME BARCODE FOR .NET WINFORMS PURCHASE

Generating Barcodes in .NET Windows Application



Quick Navigate



 

1. Run Demo Windows Application

  1. Unzip the trial package.
  2. Open it, and go to folder BarcodeDemoSRC. Click and run BarcodeDemo.exe.
  3. To view BarcodeDemo.exe source code (in C#), please go to src folder.
 

2. Install Barcode for .NET dll Component

  1. Add Reference BarcodeLib.Barcode.WinFroms.dll to your project. Do not copy the dll to the bin directory, Visual Studio will do so, during project compilation time.
    1. In your .NET windows project, right click mouse over Refereces in your Solution Explorer window. Then click menu "Add Reference ...".
    2. Add BarcodeLib.Barcode.WinFroms.dll to your project.
  2. Add barcode library to your Visual Studio Toolbox.
    1. Open Toolbox in Visual Studio. Click menu View, and check submenu Toolbox.
    2. Right click Toolbox, click menu Choose Items...
    3. Goto .NET Framework Components tab.
    4. If no BarcodeLib component found, click Browse... button and select BarcodeLib.Barcode.WinFroms.dll file.
    5. Then sort "Namespace" column, you will find 8 components from BarcodeLib.Barcode.
    6. Check component DataMatrixWinForm, and its namespace is BarcodeLib.Barcode.
    7. Check component LinearWinForm, and its namespace is BarcodeLib.Barcode.
    8. Check component PDF417WinForm, and its namespace is BarcodeLib.Barcode.
    9. Check component QRCodeWinForm, and its namespace is BarcodeLib.Barcode.
    10. Click "OK" button, you will find four components under "Common Controls": LinearWinForm, DataMatrixWinForm, PDF417WinForm, QRCodeWinForm.
  3. Now you can see the component displayed on Toolbox. Thn, you can drag LinearWinForm on your form and change barcode setting through properties widnow.
 

3. Generate Barcodes in .NET Class

Besides using Windows controller to draw barcodes on your Windows forms, you can also generate barcodes in your .net class directly.

The following C#.net code illustrates how to generate a 1d (linear) barcode in a C# class:

	BarcodeLib.Barcode.Linear barcode = new BarcodeLib.Barcode.Linear();

	barcode.Type = BarcodeType.CODE39;

	barcode.Data = "CODE39";

	barcode.UOM = 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
	barcode.drawBarcode("C://barcode.png");
	
	// generate barcode & output to byte array
	byte[] barcodeInBytes = barcode.drawBarcodeAsBytes();
	
	// generate barcode to Graphics object
	Graphics graphics = ...
	barcode.drawBarcode(graphics);
	
	// generate barcode and output to Bitmap object
	Bitmap barcodeInBitmap = barcode.drawBarcode();
	
	// generate barcode and output to HttpResponse object
	HttpResponse response = ...;
	barcode.drawBarcode(response);
	
	// generate barcode and output to Stream object
	Stream stream = ...;
	barcode.drawBarcode(stream);
 

4. Property Settings for Each Barcode Types











   Copyright BarcodeLib.com. All rights reserved.