http://zxingnet.codeplex.com/

https://www.cnblogs.com/WhyShang/p/3704513.html

privatevoidbutton1_Click(objectsender,EventArgse){stringmsg=textBox1.Text;Imageimg=GenByZXingNet(msg);this.pictureBox1.Image=img;}///<summary>///生成二维码图片///</summary>///<paramname="strMessage">要生成二维码的字符串</param>///<paramname="width">二维码图片宽度</param>///<paramname="height">二维码图片高度</param>///<returns></returns>privateBitmapGenByZXingNet(stringmsg){BarcodeWriterwriter=newBarcodeWriter();writer.Format=BarcodeFormat.QR_CODE;writer.Options.Hints.Add(EncodeHintType.CHARACTER_SET,"UTF-8");//编码问题writer.Options.Hints.Add(EncodeHintType.ERROR_CORRECTION,ZXing.QrCode.Internal.ErrorCorrectionLevel.H);constintcodeSizeInPixels=250;//设置图片长宽writer.Options.Height=writer.Options.Width=codeSizeInPixels;writer.Options.Margin=0;//设置边框ZXing.Common.BitMatrixbm=writer.Encode(msg);Bitmapimg=writer.Write(bm);returnimg;}