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条形码二维码标签编辑打印软件的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 312312dd
- 下一篇: [WPF 如何] 如何向 ComboBo