using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using QMAPP.FJC.Entity.Injection; using ThoughtWorks.QRCode.Codec; using System.Drawing.Imaging; namespace QMAPP.WinForm.Forms.Injection { public partial class InjectIntoBarcode : Form { InjectionInfo Info = new InjectionInfo(); public InjectIntoBarcode(InjectionInfo recorder) { Info = recorder; InitializeComponent(); } private void InjectIntoBarcode_Load(object sender, EventArgs e) { if (Info != null) { this.labMaterislInfo.Text = Info.MATERIAL_CODE; this.labBatchInfo.Text = Info.MATERIALBATCH; this.labMemoInfo.Text = Info.MATERIAL_NAME; } this.Write_InjectIntoBarcode(Info); } private void Write_InjectIntoBarcode(InjectionInfo Model) { Image image; string batch = Model.MATERIAL_CODE + "," + Model.MATERIALBATCH; QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(); qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE; //qrCodeEncoder.QRCodeScale = Convert.ToInt32(TextBox_QrCodeSize.Text);//尺寸 qrCodeEncoder.QRCodeVersion = Convert.ToInt32(5);//版本 qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M; image = qrCodeEncoder.Encode(batch); if (image != null) { this.picBarcode.Image = image; } } } }