using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//My Usings
using Drawing = System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
using ThoughtWorks.QRCode.Codec;
using ThoughtWorks.QRCode.Codec.Ecc;
using ThoughtWorks.QRCode.Codec.Reader;
using ThoughtWorks.QRCode.Codec.Reader.Pattern;
using ThoughtWorks.QRCode.Codec.Data;
using ThoughtWorks.QRCode.Codec.Util;
using ThoughtWorks.QRCode.ExceptionHandler;
using ThoughtWorks.QRCode.Geom;
namespace MSQs
{
class Program
{
static void Main(string[] args)
{
string savePath = @"D:\2DCodeImages\2DQRB.png";
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;
qrCodeEncoder.QRCodeScale = 4; //Size:1~10, smaller~bigger
qrCodeEncoder.QRCodeVersion = 4;//The version more higher, contains more data.
qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
//qrCodeEncoder.QRCodeForegroundColor = Drawing.Color.FromArgb(163, 73, 164);
String data = "http://www.zhanjiangying.com";
System.Drawing.Bitmap image = qrCodeEncoder.Encode(data);
image.Save(savePath, System.Drawing.Imaging.ImageFormat.Png);
Console.WriteLine("Finished!");
Console.ReadLine();
}
}
}
转载于:https://my.oschina.net/u/1538037/blog/213458