Code 128 Barcode FAQ in C#.NET Barcode Generator DLL

C# class to set and change Code 128 images and properties in .NET framework with free C# samples
Barcode in C# > Linear > Code 128 FAQ
Generate Barcode Image Using C#.NET with Barcode Library DLL - Code 128 Barcode FAQ in C#
Code 128 barcode image generator & Library SDK in C#.NET is a robust and reliable barcode generation component DLL that completely runs in C#.NET projects to generate and create high quality and dynamical Code 128 images that can be saved in images files as well as in the memory. Using C# class method with barcode creator DLL generates barcodes is easy and simple, for 40+ linear and 2D barcode functions and compatibilities are built together as the DLL. Only change the barcode symbols and relevant barcode data with C# programming, a target barcode image is generated.
This page gives detail information of Code 128 barcode property settings using C# class method with the following aspects:
  • Generate Code 128 Barcode Images Using C# Class - Code 128 Barcode Data Encoding
  • Generate Code 128 Barcode Images Using C# Class - Code 128 Barcode Special Settings
  • Generate Code 128 Barcode Images Using C# Class - Code 128 Barcode Size Adjustment
  • Generate Code 128 Barcode Images Using C# Class - Code 128 Barcode Image Customization
  • Generate Code 128 Barcode Images Using C# Class - Code 128 Barcode Solution Project Support
Generate Barcode Using C#.NET with Barcode Library DLL - Code 128 Data Encoding
Linear Code 128 Barcode Valid Data
Code 128 barcode is able to encode all the ASCII characters and extended ASCII characters that is:
  • Standard ASCII characters: 0-127 including A-Z, a-z, 0-9 and special characters
  • Extended ASCII characters: 128-255
Code 128 C#.NET Sample Code:
code128. Symbol = BarcodeSymbol.Code128;
code128.BarcodeData = "Code128";
Code 128 Barcode Text Option
Linear Code 128 barcode is able to show or hide the barcode data with barcode generation SDK using C# class. If showing the human-readable text, the color, the font and other text settings are able to be customized.
Code 128 barcode C#.NET Sample Code:
code128.DisplayData = true;
code128.TextStyle = new Font("Arial", 9f, FontStyle.Regular);
code128.TextColor = Color.Black;
code128.TextSpace = 6;
Generate Barcode Using C#.NET with Barcode Generator DLL - Code 128 Special Settings
Code 128 Barcode Wide to Narrow Ratio
As the name specified, it means the ratio between wide bar and narrow bar, the value ranges from 2.0 to 3.0. The default is 2, developers may change the value through WideVSNarrow property.
Code 128 C#.NET Sample Code: code128. WideVSNarrow = 2.0f;
Code 128 Barcode Code Set
Code 128 has three code sets that is Code set A, Code set B, and Code set C. Code set A encodes upper case letters, punctuation characters and control characters. Code set B encodes upper case letters, lower case letters and punctuation characters. Code set C encodes the set of 100 digit pairs from 00 to 99 inclusive. If programmers are not familiar with these Code 128 code set, Auto set is supplied with barcode generator and control SDK for Terrek. Users may select different Code 128 Code sets using Symbol property.
Code 128 C#.NET Sample Code:
code128. Symbol = BarcodeSymbol.Code128;
code128. Symbol = BarcodeSymbol. Code128_A;
code128. Symbol = BarcodeSymbol. Code128_B;
code128. Symbol = BarcodeSymbol. Code128_C;
Code 128 Tilde Function
Using tilde function in Code 128, Code 128 is able to encode special characters such as Tab, Fn, Return and other function charcaters. Users may set the Tilde property to apply this function.


Code 128 C#.NET Sample Code: Code128.Tilde = true;
Encode Barcode Image in C# with Barcode Generator Library - Code 128 Size Adjustment
Code 128 Bar Size
The X and Y dimension size for Code 128. In barcode generator & control library, they are BarWidth and BarHeight. The whole barcode image is changed according to the adjustment of bar width and bar height.
Code 128 C#.NET Sample Code:
Code128.BarWidth = 1;
Code128.BarHeight =40;
Code 128 Image Size
If the breakdown parameters are unknown, you can set the width and height of the barcode image directly. Once you enabled the image resize function, you only need to provide the size of entire barcode image. This intelligent Code 128 will draw the barcode with reasonable parameters. The generated Code 12228 is 100% compatible with International Standard ISO/IEC 15417
Code 128 C#.NET Sample Code:
code128.ImageWidth = 100;
code128.ImageHeight = 100;
Code 128 Margin Size
Increasing the width of margins around the symbol is one way to enhance the readability of the Code 128 barcode image. The control library set the left, right, top, and bottom margins separately with float values. The default value is 0.
Code 128 C#.NET Sample Code:
code128. MarginL = 2;
code128. MarginR = 2;
code128. MarginT = 2;
code128. MarginB = 2;
Insert Barcode Image in C# with Barcode Generator Library - Code 128 Image Customization
Code 128 Image Format
Code 128 generated in C#.NET project with barcode control DLL library can be displayed as Gif, Tiff, Bmp, Png, Jpeg and other image formats. Programmers may change the format using BarcodeFormat property.
Code 128 C#.NET Sample Code:
code128.BarcodeFormat = System.Drawing.Imaging.ImageFormat.Png;
code128.drawBarcode("C:\\code128.png");
Code 128 Image Resolution
DPI (Dots per inch) is used commonly as the measure of printing resolution. The resolution of image generated by Code 128 generator could be managed with DPI.

Code 128 C#.NET Sample Code:
code128.DotsPerInch = 96;
Code 128 Image Position
Code 128 position may be influenced by two factors, one is barcode alignment, and the other is rotation. Programmers may set the position by Rotation and BarAlign respectively.
Code 39 C#.NET Sample Code:
code128.BarAlign = BarAlign.Center;
code128.Rotation = Rotation.Degree0;
Code 128 Image Color
It is able to change barcode colors with barcode control library DLL using C#.NET class. Both background color and foreground color are easy to be changed by manipulating ImageColor and BarColor respectively.
Code 128 C#.NET Sample Code:
code128. ImageColor = Color.White;
code128. BarColor = Color.Black;
Generate Barcode Using C#.NET with Barcode Library DLL - Code 128 Solution Development
Using C#.NET to create Code 128 barcode images, developers are entitled to create, draw Code 128 barcode images in various development environments. And the following projects can be adopted to fulfill your .NET projects.
  • Windows Forms Application (design-time and runtime support)
  • Console Application (runtime support)
  • Class Library (runtime support)
  • Windows Service (runtime support)
  • ASP.NET Applications (design-time and runtime support)
  • Web Service (runtime support)
  • Crystal Report for .NET (runtime support)
  • Reporting Service Applications (design-time and runtime support)