利用QrCode.Net生成二唯码,需要将QrCode.Net dll下载下来
QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.H); QrCode qrCode = new QrCode(); qrEncoder.TryEncode("http://www.xxx.com", out qrCode); int ModuleSize = 6; QuietZoneModules QuietZone = QuietZoneModules.Two; var render = new GraphicsRenderer(new FixedModuleSize(ModuleSize, QuietZone)); using (Stream stream = File.OpenWrite("d:/1.png")) { render.WriteToStream(qrCode.Matrix,ImageFormat.Png,stream); } Console.WriteLine("生成成功"); Console.ReadKey();