using JinYuan.Models; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Linq; using QRCoder; namespace LargeSquareOne { public partial class FrmQRCoder : Language.MultiLanguageForm { public FrmQRCoder() { InitializeComponent(); } public void ShowBatteryQRCoder(List list) { try { foreach (var item in list) { QRCodeGenerator qrGen = new QRCodeGenerator(); QRCodeData data = qrGen.CreateQrCode(item.identification, QRCodeGenerator.ECCLevel.Q); QRCode qrcode = new QRCode(data); Bitmap qrBitmap = qrcode.GetGraphic(20, Color.Black, Color.White, null, 15); Panel container = new Panel { Width = 260, Height = 300}; PictureBox pb = new PictureBox { Image = qrBitmap, SizeMode = PictureBoxSizeMode.Zoom, Location = new Point(10, 10), Size = new Size(240, 240) }; Label lbl = new Label { Text = $"{item.location}", TextAlign = ContentAlignment.MiddleCenter, //Dock = DockStyle.Bottom, Location = new Point(10, 250), Size = new Size(240, 30), Font = new Font("微软雅黑", 12, FontStyle.Bold) }; container.Controls.Add(pb); container.Controls.Add(lbl); this.flowLayoutPanel1.Controls.Add(container); } } catch { } } } }