(71)C# zxing.net 二维码 条形码
https://archive.codeplex.com/?p=zxingnet
using System; using System.Drawing; using System.Windows.Forms; using ZXing; using ZXing.QrCode; namespace WindowsFormsApp2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { BarcodeWriter barcodeWriter = new BarcodeWriter(); QrCodeEncodingOptions options = new QrCodeEncodingOptions(); //options.Width = 10; //options.Height = 10; options.Width = pictureBox1.Width; options.Height = pictureBox1.Height; options.DisableECI = true; options.CharacterSet = "UTF-8"; options.Margin = 1; //二维码格式 barcodeWriter.Format= BarcodeFormat.QR_CODE; barcodeWriter.Options = options; //内容 Bitmap map = barcodeWriter.Write("hello world"); //将Bitmap转换成Image对象 Image img = Image.FromHbitmap(map.GetHbitmap()); pictureBox1.Image = map; } } }
运行
BarcodeFormat.CODE_128 ;//一维码