31 Oct 20192 minutes to read
The color of the Barcode can be customized by using the properties of
LightBarBrush in the
The DarkBarBrush represents the Color of the dark bar (Black color by default) and the LightBarBrush represents the color of the gap between two adjacent black bars (White color by default).
//Changes the color of darker area of Barcode. barcode.DarkBarColor = Color.Blue; //Changes the color of lighter area of Barcode. barcode.LightBarColor = Color.Red;
Barcode with bar color customization
LightBarBrushcustomizations are applicable only for one dimensional Barcodes. In order, to recognize a Barcode symbol by a scanner, there must be an adequate contrast between the dark bars and the light spaces. All the Barcode scanners do not have support for colored Barcodes.
The text representing the Barcode can be customized by using the following properties.
- The color of text can be altered by using the
- The size of text can be altered by using the
- The horizontal alignment of text can be customized with the help of the
- The gap between Barcode and text can be adjusted by setting the property of
- To change the location of text vertically, you can make use of the
TextLocationproperty with options of top and bottom location.
//Changes the color of text. barcode.TextColor = Color.Red; //Changes the size of text. barcode.TextFont = Font.SystemFontOfSize(25); //Changes the font style of text. Typeface textStyle = Typeface.create("Times new roman",1); barcode.TextFont = textStyle**;** //Changes the height of gap between text and Barcode. barcode.TextGapHeight = 30; //Changes the location of text. barcode.TextLocation = BarcodeTextLocation.Bottom; //Changes the alignment of text. barcode.TextAlignment = BarcodeTextAlignment.Center;
Barcode with text customization