using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using ZXing.QrCode; using ZXing; using Steema.TeeChart.Web; namespace Mesnac.Action.ChemicalWeighing.BinManage { public partial class FormBarcode : Form { public FormBarcode() { InitializeComponent(); } public FormBarcode(string barcodeStr) { InitializeComponent(); GenerateCode(barcodeStr); } /// /// 生成条码 /// /// private void GenerateCode(string barcodeStr) { try { BarcodeWriter barcodeWriter = new BarcodeWriter() { Format = BarcodeFormat.QR_CODE, Options = new QrCodeEncodingOptions { DisableECI = true, CharacterSet = "UTF-8", Width = 300, Height = 100, Margin = 0 } }; //创建图片并保存为PNG格式 Bitmap img = barcodeWriter.Write(barcodeStr);//生成图片 //img.Save("E:\\12312.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); pictureBox1.Image = img; } catch (Exception) { } } } }