Two-dimensional Code generation demo

Source: Internet
Author: User

Directly referencing the ThoughtWorks.QRCode.dll class in C #,

Download DLL Classes

Http://file.111cn.net/download/2013/06/29/201205161654200565.rar

   protected voidButton1_Click (Objectsender, EventArgs e) {Qrcodeencoder Qrcodeencoder=NewQrcodeencoder (); Qrcodeencoder.qrcodeencodemode= Qrcodeencoder.encode_mode. Alpha_numeric;//encoding Method (Alpha_numeric: Letters and Numbers, byte: bytes, more for Chinese characters, NUMERIC: Numbers)Qrcodeencoder.qrcodescale =4;//size (the larger the value, the higher the image pixel of the resulting QR code)Qrcodeencoder.qrcodeversion =7;//Version (note: setting to 0 is primarily to prevent the encoding of strings from being too long when an error occurs, 7)Qrcodeencoder.qrcodeerrorcorrect = qrcodeencoder.error_correction. M//error validation, error correction (4 levels)        stringdata ="NI";//here is the reseller pathString Ls_filename ="P"+datetime.now.tostring ("YYYYMMDDHHMMSS") +". PNG"; String Ls_savepath= Server.MapPath (".") +"/qrcodeimages/"+ Ls_filename;//        //System.Text.Encoding.GetEncoding ("GB2312")//If the content is in Chinese need to encode (utf-8,gb2312)Qrcodeencoder.encode (data, System.Text.Encoding.GetEncoding ("Utf-8")).        Save (Ls_savepath); Image1.imageurl=("qrcodeimages/"+ls_filename); }

Two-dimensional code generation demo

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.