BizCode Barcode Generator for .NET Ultimate
The most robust & powerful barcode generating SDK for Microsoft .NET Framework
Quick Overviews
  • Mature barcode creating SDK
  • Support .NET 2.0/3.0/4.0
  • 100% developed in C#.NET
  • Dynamic barcodes support
  • User-defined controls provided
How to Generate Code 128 images in C#
Code 128 Generator for C#.NET is one function of Barcode Generator for .NET Ultimate, which is a mature & user-friendly .NET barcode generating SDK that can be easily installed in any Visual C#.NET development environments and applications.
Code 128 Generator for C#.NET provides 100% C#.NET sample code for Code 128 generation and support to rotate Code 128 barcode into any angle of 0, 90, 180, and 270 degrees. Besides, all generated Code 128 barcodes can be saved into major image file format as well as .NET Graphics, Stream & Bitmap objects. Here is a detailed developer guide for setting Code 128 images in Visual C#; others Code 128 sample codings, please see:
Code 128 Image Related Properties

Barcode Margin

Users may easily manage the size of quiet margins that are blank zones surrounding the four sides of Code 128 barcodes with QuietMargin related properties provided by Barcode Generator for .NET Ultimate.

Barcode Resolution

Users may easily change barcode resolution in DPI that can be used for both high-resolution output and low-resolution output printers with Resolution property provided by Barcode Generator for .NET Ultimate.

Barcode Rotation

Users may easily change barcode rotation angle into 0, 90, 180 and 270 degrees that can be recognized by all scanners with Rotate property provided by Barcode Generator for .NET Ultimate.

Image Formats

Users may easily save barcode images into various image formats for different purpose, like Png, Jpeg/Jpg, Gif, Tiff, Bmp, with ImageFormat property provided by Barcode Generator for .NET Ultimate.

C#.NET Graphic Objects

Users may easily save barcode images into .NET graphic objects, Graphics, Stream and Bitmap objects, with DrawBarcode property provided by Barcode Generator for .NET Ultimate.
Customize Code 128 Barcode Images in C#.NET
If you want to customize Code 128 image in C#.NET, be sure that you have installed:
Customize Code 128 Barcode Images in .NET Project Using C# Class
Copy those following code onto your C#.NET projects:
using BusinessRefinery.Barcode;

Linear barcode = new Linear();
barcode.Symbology = Symbology.CODE128;
barcode.Code = "0123456789";

barcode.drawBarcode2ImageFile("c:/code-128-csharp.gif");
Change Code 128 Resolution in DPI
Resolution default value in Barcode Generator for .NET Ultimate is 72 dpi.

Copy those following code to change your resolution:
barcode.Resolution = 104;
Adjust Code 128 Barcode Quiet Margin
BottomMargin, TopMargin , LeftMargin and RightMargin default value in Barcode Generator for .NET Ultimate is 0 respectively.

Copy those following code to change your quiet margin size:
barcode.Resolution = 104;
Change Code 128 Image Rotation
Resolution default value in Barcode Generator for .NET Ultimate is Rotate.Rotate0.

Copy those following code to change your image rotation angle:
barcode.Rotate = Rotate.Rotate180;
Show Code 128 Barcode Human-Readable Text
DisplayText default value in Barcode Generator for .NET Ultimate is true.

TextFont default value in Barcode Generator for .NET Ultimate is new Font("Arial", Font.PLAIN, 11).

TextMargin default value in Barcode Generator for .NET Ultimate is 6 pixel.

Copy those following code to change your human-readable text:
barcode.DisplayText = true;
barcode.TextFont = new Font("Arial", 11.0f, FontStyle.Bold);
barcode.TextMargin = 10;
Save Code 128 in Multiple Image Formats
Format default value in Barcode Generator for .NET Ultimate is gif.

Copy those following code to change your image format:
barcode.Format = ImageFormat.Png;
barcode.drawBarcode2ImageFile("c:/ean-128-csharp.Png");
Users may change image format into gif, png, tiff, jpeg, png; or save it as C#.NET graphic objects:
public void drawBarcode2ImageFile(string filename);
public void drawBarcode2Stream(Stream fileStream);
public byte[] drawBarcodeAsBytes();
public Bitmap drawBarcodeOnBitmap();
public void drawBarcodeOnGraphics(Graphics graphics);