How to create barcode with colors customized using VB.NET?
Barcode images can be generated & printed in different color combinations. And VB.NET barcode image generating dll uses some simple VB.NET class codes to construct & save colorful barcode images. Using VB.NET codes, users can generate & customize barcode displaying colors, like image background color, foreground color, and human readable text color.
All VB.NET sample source codes on this page are developed with the following environment and libraries.
- .NET 7
- Visual Studio 2022
- OnBarcode.Barcode.Common.dll (.net standard 2.0 version)
- System.Drawing.Common (NuGet version 7.0.0)
Draw barcode bar & space module colors
The VB.NET code below explains how to customize QR Code bar and space colors using VB.NET Barcode Generator library.
- Create a
QRCodeobject with encoding data - Set the barcode bar module color using property
ForeColor - Set the barcode space module color using property
BackColor - Print the color styled QR Code to a PNG image file
Dim barcode = New QRCode() barcode.Data = "https://www.onbarcode.com" barcode.ForeColor = Color.Red barcode.BackColor = Color.White barcode.drawBarcode("C://Output//vb-net-barcode-colors-demo.png")
Print barcode image with transparent background-color
OnBarcode.com is one of the few barcode image generator providers which can support generating & printing transparent barcode images
using VB.NET. Currently, only barcode images in png and gif image format can support this transparent barcode imaging style.
To create a barcode image with transpant background-color,
- Set the property
BackColorwith valueColor.Transparent - The output barcode file format should be
PNGorGIF.
Dim barcode = New Linear() barcode.Data = "Code 128" barcode.Type = BarcodeType.CODE128 barcode.ForeColor = Color.White barcode.BackColor = Color.Transparent barcode.TextColor = Color.White barcode.drawBarcode("C://Output//vb-net-barcode-transparent-background-demo.png")
Print 1D / linear barcodes text label color
You can also customize the 1d/linear barcode human reable text color style using VB.NET Barcode library.
- Set the property
TextColorto change the 1d barcode human readable text color.
Dim barcode = New Linear() barcode.Data = "Code 128" barcode.Type = BarcodeType.CODE128 barcode.ForeColor = Color.Purple barcode.BackColor = Color.White barcode.TextColor = Color.Red barcode.drawBarcode("C://Output//vb-net-barcode-1d-barcode-text-color-demo.png")
Print barcode in EPS file with CMYK colors applied
When you generate and print barcode to EPS vector image format, the vb.net barcode library will draw barcode in RGB color by default.
You can config barcode generation option to print barcode in EPS with CMYK colors.
EPS Barcode file viewed in Acrobat
- Set the property
UseCMYKInEPSto true to enable EPS file with CMYK colors.
Dim barcode = New Linear() barcode.Data = "Code-128" barcode.Type = BarcodeType.CODE128 barcode.OutputFileFormat = FileFormat.EPS barcode.UseCMYKInEPS = True barcode.drawBarcode("C://Output//vb-net-barcode-in-eps-cmyk-color-demo.eps")
EPS Barcode file viewed in Acrobat
How to create barcode in raster image format using VB.NET?
VB.NET barcode image generating control from OnBarcode.com supports encrypting & saving generated barcode images in several image file formats,
including JPEF, PNG, GIF, BMP and TIFF.
OnBarcode VB.NET Barcode Generator supports the barcode generation with the following raster image formats
- PNG
- JPG (JPEG)
- TIFF
- BMP (bitmap)
- GIF
barcode.OutputFileFormat = FileFormat.PNG barcode.OutputFileFormat = FileFormat.JPG barcode.OutputFileFormat = FileFormat.TIF barcode.OutputFileFormat = FileFormat.BMP barcode.OutputFileFormat = FileFormat.GIF
Print barcode in high resolution (dpi) raster image
VB.NET barcode generator library supports high resolution (dpi) barcode image for printers.
- OutputFileFormat: Choose raster image format as
PNG,JPG, orBMP. Please do not chooseGIF. The GIF image format does not support image resolution setting. - Resolution: The value of the resolution should be larger than your printer's resolution.
How to create barcode in SVG or EPS vector image using VB.NET?
Generate barcode in SVG format
- OutputFileFormat: Choose value
FileFormat.SVGto create and render barcode in SVG vector image file in vb.net class.
Dim barcode = New Linear() barcode.Data = "Code-128" barcode.Type = BarcodeType.CODE128 barcode.OutputFileFormat = FileFormat.SVG barcode.drawBarcode("C://Output//vb-net-barcode-in-svg.svg")
SVG Barcode file viewed in web browser
Generate barcode in EPS format
- OutputFileFormat: Choose value
FileFormat.EPSto create and draw barcode in EPS vector image file in vb.net.
Dim barcode = New Linear() barcode.Data = "CODE39" barcode.Type = BarcodeType.CODE39 barcode.OutputFileFormat = FileFormat.EPS barcode.drawBarcode("C://Output//vb-net-barcode-in-eps.eps")
EPS Barcode file viewed in Acrobat
VB.NET Barcode Generation Guide for Supported Barcode Images
.NET Barcode Control DLL for VB.NET - Barcodes Generation
- VB.NET Linear Barcode Images:
- VB.NET Matrix Barcode Images: Data Matrix, PDF417, QR Code, Micro PDF417, Micro QR Code
