ZXing.Net条形码二维码标签编辑打印软件
生活随笔
收集整理的這篇文章主要介紹了
ZXing.Net条形码二维码标签编辑打印软件
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
- KopSoftTool 條形碼二維碼標簽編輯打印軟件,C#串口通信SerialPort
- 官網?http://kopsoft.cn/
- github源碼?https://github.com/williamyang1984/KopSoftTool
- gitee源碼?https://gitee.com/william_yang/KopSoftTool
?
ZXing.Net條形碼二維碼打印軟件
C#打印 1.建立PrintDocument對象2.設置PrintPage打印事件3.調用Print方法進行打印
Microsoft .NET Framework 4.5
ZXing.Net
BarcodeWriter用于生成圖片格式的條碼類,通過Write函數進行輸出
BarcodeFormat枚舉類型,條形碼/二維碼
QrCodeEncodingOptions二維碼設置選項,繼承于EncodingOptions,主要設置寬,高,編碼方式等
MultiFormatWriter復合格式條碼寫碼器,通過encode方法得到BitMatrix
BitMatrix表示按位表示的二維矩陣數組,元素的值用true和false表示二進制中的1和0
?
?
?
using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using ZXing; using ZXing.QrCode;namespace KopSoftPrint {internal class QRCode{public void GenerateQRCode(string contents, PictureBox qrimage){BarcodeWriter barcodeWriter = new BarcodeWriter{Format = BarcodeFormat.QR_CODE,Options = new QrCodeEncodingOptions{DisableECI = true,CharacterSet = "UTF-8",Width = qrimage.Width,Height = qrimage.Height,Margin = 1 //二維碼邊距 }};Bitmap bitmap = barcodeWriter.Write(contents);qrimage.Image = bitmap;}} } View Code public void Print(int Number){pd.DefaultPageSettings.PaperSize = new PaperSize("", 999, 999); //設置紙張大小StandardPrintController controler = new StandardPrintController();if (dataGridView1.CurrentCell != null){for (int j = 0; j < dataGridView1.SelectedRows.Count; j++) //遍歷所有選中的行 {rowIndex = dataGridView1.SelectedRows[j].Index;try{pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);pd.PrintController = controler;for (int i = 0; i < Number; i++){pd.Print();}}catch (Exception e){Console.WriteLine(e.Message);return;}finally{pd.Dispose();}}}} View Code?
?
加強版地址?https://www.cnblogs.com/williamyoung/p/10752970.html
?
轉載于:https://www.cnblogs.com/williamyoung/p/10535198.html
總結
以上是生活随笔為你收集整理的ZXing.Net条形码二维码标签编辑打印软件的全部內容,希望文章能夠幫你解決所遇到的問題。