Generate barcodes and QR codes using Google Z

Source: Internet
Author: User

: http://zxingnet.codeplex.com/

Zxing.net is a tool for barcode and QR code under the. NET platform, which is very convenient to use.

First download the binary DLL file, introduce the project;

Using system;using system.collections.generic;using system.componentmodel;using system.data;using System.Drawing; Using system.text;using system.windows.forms;using zxing.qrcode;using zxing;using zxing.common;using ZXing.Rendering        ; namespace zxingtest{public partial class Form1:form {encodingoptions options = null;        Barcodewriter writer = null;            Public Form1 () {InitializeComponent ();                Options = new Qrcodeencodingoptions {Disableeci = true, CharacterSet = "UTF-8",            Width = pictureboxqr.width, Height = pictureboxqr.height};            writer = new Barcodewriter (); Writer.            Format = Barcodeformat.qr_code; Writer.        options = options; The private void Buttonqr_click (object sender, EventArgs e) {if (Textboxtext.text = = string. Empty) {MessageBox.Show ("the input cannot be empty!                "); ReTurn } Bitmap Bitmap = writer.            Write (Textboxtext.text);        Pictureboxqr.image = bitmap; }    }}

Character formatting can be specified when characters are encoded, the default is iso-8859-1 English character set, but generally mobile devices commonly used UTF-8 character set encoding,

Encoding can be set by Qrcodeencodingoptions.

If you want to generate additional zxing-supported barcodes, just modify the Barcodewriter.format.

Using system;using system.collections.generic;using system.componentmodel;using system.data;using System.Drawing; Using system.text;using system.windows.forms;using zxing.qrcode;using zxing;using zxing.common;using ZXing.Rendering        ; namespace zxingtest{public partial class Form1:form {encodingoptions options = null;        Barcodewriter writer = null;            Public Form1 () {InitializeComponent ();                Options = new Encodingoptions {//disableeci = true,//characterset = "UTF-8",            Width = pictureboxqr.width, Height = pictureboxqr.height};            writer = new Barcodewriter (); Writer.            Format = BARCODEFORMAT.ITF; Writer.        options = options; The private void Buttonqr_click (object sender, EventArgs e) {if (Textboxtext.text = = string. Empty) {MessageBox.Show ("the input cannot be empty!                "); Return           } Bitmap Bitmap = writer.            Write (Textboxtext.text);        Pictureboxqr.image = bitmap; }    }}

Generate barcodes and QR codes using Google Z

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.