KA.Barcode for .NET WinForms
How to Create & Resize UPC-A in .NET WinForms
Source code to generate, print UPC-A images using Barcode Generator for .NET WinForms Control
  • Simple to integrate UPC-A in .NET Framework and Microsoft Visual Studio
  • Easily generate, print UPC-A bar code images in Windows applications and Crystal Reports
  • Provide barcode SDK for implementing barcodes as you wish, like QR Code ASP.NET, .NET WinForms UPC-A, .NET Interleaved 2 of 5, Word EAN 128, etc.
  • Printing, generating UPC-A picture with specified bar width and bar height
  • Make multiple high-quality UPC-A 1D image with fixed size by setting barcode width & height
  • Adjust UPC-A supplemental addon height and space if any
  • Insert linear and GS1 barcodes , such as Intelligent Mail .NET WinForms, EAN-13 VB.NET, C# Code 128, Data Matrix .NET WinForms, in your applications
  • Flexible setting features for surrounding margins of 1D UPC-A image integration
  • Royalty free with purchase of a Developer License
UPC-A Barcode Creator Component Software API for .NET WinForms is a powerful barcode library addin which prints, generates accurate UPC-A, UPC-A+2, UPC-A+5 and other linear, bidimensional barcodes in .NET Windows applications, Crystal Reports, C# & VB.NET class & console applications.
This page will guide you to generate UPC-A with a proper size. For more tutorials with sample codings, please check out here:
UPC-A Size Setting with C#, VB.NET Class in .NET WinForms

Install UPC-A Barcode Creator Component Library into .NET WinForms

  1. 1.
  2. 2.
    Add reference: Add "KeepAutomation.Barcode.Windows.dll" to your .NET WinForms project reference
  3. 3.
    Add to toolbox: To add UPC-A BarcodeControl to your ASP.NET toolbox
Copy the C#, VB.NET demo code syntax to your projects for creating, drawing a UPC-A in .NET Windows applications:
using KeepAutomation.Barcode.Bean;
BarCode barcode= new BarCode();
barcode.Symbology= KeepAutomation.Barcode.Symbology.UPCA;
barcode.CodeToEncode = "25896321456";
barcode.generateBarcodeToImageFile("C://upca-csharp.gif")
Dim barcode As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode

barcode.Symbology= KeepAutomation.Barcode.Symbology.UPCA
barcode.CodeToEncode = "25896321456"
barcode.generateBarcodeToImageFile("C://upca-vbnet.gif")

Drawing UPC-A with Pixel as Unit of Measure

By default, KA.Barcode Generator for .NET WinForms will create UPC-A barcode with Pixel as unit of measure. However, users can shift to other unit of measure for barcode generation, such as Cm and Inch. Here is the demo code for you.
barcode.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel;
barcode.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel

Creating UPC-A with Defined Bar Width & Bar Height (X & Y)

To control generated UPC-A bar code size, you can simply generate UPC-A with defined bar width and height by setting the "X" and "Y" dimensions. Default value is one pixel for width and 50 pixels for bar height. Copy the sample code below to adjust.
barcode.X = 2;
barcode.Y = 60;
barcode.X = 2
barcode.Y = 60

Generating UPC-A with Fixed Size (BarCodeWidth & BarCodeHeight)

When space is concerned, users may want to generate a UPC-A image with a fixed bar code size. You can easily do so by adjusting "BarCodeWidth" and "BarCodeHeight" parameters. Here is the demo code for you.
barcode.BarCodeWidth = 150;
barcode.BarCodeHeight = 70;
barcode.BarCodeWidth = 150
barcode.BarCodeHeight = 70

Adjusting Supplement Bar Height and Space

If you want to encode some extra information in a UPC-A bar code image, you might want to generate a UPC-A with a two-digit or five-digit addon symbol.
You need to select the correct barcode type with addon and then adjust supplemental bar height and space. Default value for supplement height is 0.8 (meaning 80% the height of primary bar height), and supplement space is 15 (pixels).
barcode.Symbology= KeepAutomation.Barcode.Symbology.UPCASup2;
barcode.CodeToEncode = "12825484512";
barcode.SupplementCode = "02";
barcode.SupplementHeight = 0.8f;
barcode.SupplementSpace = 15;
barcode.Symbology= KeepAutomation.Barcode.Symbology.UPCASup2
barcode.CodeToEncode = "12825484512"
barcode.SupplementCode = "02"
barcode.SupplementHeight = 0.8f
barcode.SupplementSpace = 15
UPC-A Size Setting with Drag & Drop BarcodeControl in .NET WinForms
  1. 1.
    Add .NET WinForms BarCodeControl into Visual Studio .NET Toolbox
  2. 2.
    Drag and drop the BarCodeControl into the Forms to generate a Codabar at default
  3. 3.
    Right click the barcode to select "Properties" and choose"UPCA" in the "Symbology" and input data to encode
  4. 4.
    Set "X" to 2, "Y" to "60", "BarCodeHeight" to 70, and "BarCodeWidth" to 150 pixels
  5. 5.
    Click the generated barcode and the customized UPCA is updated