Barcode for WPF
スタイルと外観

BarCode provides various options to style the appearance of the control, so that you can generate Barcode as per your requirement and change the look and feel of the application you are creating.

Set ForeGround

You can change the foreground color of the Barcode control by using the Foreground property of the C1BarCode class.

Barcode with styling

In the above image, we have created a barcode with dark blue foreground and beige background colors.

You can set the Foreground of the Barcode control using the following code snippet:

<c1:C1BarCode Name="barCode1" Text="ComponentOne@123" CodeType="Ansi39x" Foreground="DarkBlue" Background="beige" HorizontalAlignment="Left" Margin="134,217,0,0" VerticalAlignment="Top"/>
barCode1.Foreground = new SolidColorBrush(Colors.Blue);
barCode1.Background = new SolidColorBrush(Colors.Beige);

Set FontStyle

Barcode lets you customize the overall look of the text or caption, not to just increase its aesthetic value but also increases its readability. For example, you can make the caption in italics font using the FontStyle property. Further, you can also set the position of the caption using the CaptionPosition property.

In the snapshot below, the barcode has the caption text in italics and it is positioned above the barcode.

Font and caption in barcode snapshot

 You can set the fontstyle of the Barcode text and change the caption position using the following code snippet:

<c1:C1BarCode Name="barCode1" FontStyle="Italic" Text="ComponentOne@123" CaptionPosition="Above" CodeType="Ansi39x" HorizontalAlignment="Left" Margin="134,217,0,0" VerticalAlignment="Top"/>
barCode1.FontStyle = FontStyles.Italic;
barCode1.CaptionPosition = C1.BarCode.BarCodeCaptionPosition.Above;