This example describes a simple way to generate a barcode picture in C #. Share to everyone for your reference. The implementation method is as follows:
Implementation principle:
In fact, Windows itself has a font that is used to display barcodes.
As long as you change the number to this font it becomes a barcode.
Under the Windows Font Library, there are eight types of fonts that can be used to convert numbers to barcodes:
Code39azaleanarrow1
Code39azaleanarrow2
Code39azaleanarrow3
Code39azalearegular1
Code39azalearegular2
Code39azaleawide1
Code39azaleawide2
Code39azaleawide3
Paste the code for your reference:
The code is as follows:
Bitmap b=new Bitmap (200,200);
Graphics g = graphics.fromimage (b);
Font font = new Font ("Code39azalearegular2", 32);
g.DrawString ("123456", Font, Brushes.black, new PointF (100,100));
Picturebox1.backgroundimage = b;
Picturebox1.backgroundimagelayout = Imagelayout.zoom
I hope this article is helpful to everyone's C # programming.
In addition to the Declaration,
Running GuestArticles are original, reproduced please link to the form of the address of this article
C # simple way to generate barcode pictures
This address: http://www.paobuke.com/develop/c-develop/pbk23205.html
Related content conversion of Enum and string in C # Socket Implementation Simple console case C # generic parameter conversion C # boxed and unboxing Operations example analysis
The method of saving session value in C # program and the method of converting to string the method of using control drag-and-drop technology to make Jigsaw puzzles C # multi-threaded and cross-threaded access to interface controls C # using Icsharpcode for file compression implementation
C # simple way to generate barcode pictures