C # simple way to generate barcode pictures

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.