/// <summary> /// 生成二维码,保存成图片 /// </summary> static void Generate1(string text) { BarcodeWriter writer = new BarcodeWriter(); writer.Format = BarcodeFormat.QR_CODE; QrCodeEncodingOptions options = new QrCodeEncodingOptions(); options.DisableECI = true; //设置内容编码 options.CharacterSet = "UTF-8"; //设置二维码的宽度和高度 options.Width = 500; options.Height = 500; //设置二维码的边距,单位不是固定像素 options.Margin = 1; writer.Options = options; Bitmap map = writer.Write(text); string filename = @"H:\桌面\截图\generate1.png"; map.Save(filename, ImageFormat.Png); map.Dispose(); }
原文地址:https://www.cnblogs.com/qqhfeng/p/8984483.html
时间: 2024-10-09 19:48:39