标签:span mst sys png summary ati stream ima get
1.添加程序包
2.生产二维码方法
#region 二维码 /// <summary> /// 生成二维码 /// </summary> /// <param name="strQRcode">二维码字符串</param> /// <param name="codePath">二维码图片存储路径</param> public static void CreateQRcode(string strQRcode, string codeImgPath) { QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.H); QrCode qrCode = new QrCode(); qrEncoder.TryEncode(strQRcode, out qrCode); GraphicsRenderer renderer = new GraphicsRenderer(new FixedModuleSize(15, QuietZoneModules.Two), Brushes.Black, Brushes.White); using (MemoryStream ms = new MemoryStream()) { renderer.WriteToStream(qrCode.Matrix, ImageFormat.Png, ms); System.Drawing.Image img = System.Drawing.Image.FromStream(ms); img.Save(codeImgPath); } } #endregion
二维码生成 Gma.QrCodeNet (目前测试支持.net4.0及以上,但vs版本2010不可以 NuGet中搜索不到程序包)
标签:span mst sys png summary ati stream ima get
原文地址:https://www.cnblogs.com/catherinehu/p/11795093.html