当前位置: 首页 > news >正文

C# 条形码、二维码标签打印程序

1、条码标答打印主界面

 

2、打印设置

 3、生成QR代码

 private void GetBarcode_T(string lr)
 {
     QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();//创建一个对象         
     qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;
     //设置编码测量度
     qrCodeEncoder.QRCodeScale = 3;  //大小(值越大生成的二维码图片像素越高)
     //设置编码版本
     qrCodeEncoder.QRCodeVersion = 0; //版本(注意:设置为0主要是防止编码的字符串太长时发生错误)  

     qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
     //qrCodeEncoder.QRCodeForegroundColor = btnQRCodeForegroundColor.BackColor;//设置二维码前景色
     //qrCodeEncoder.QRCodeBackgroundColor = btnQRCodeBackgroundColor.BackColor;//设置二维码背景色
     Image image = qrCodeEncoder.Encode(lr, Encoding.UTF8);//生成二维码图片                       
     picEncode.Image = image;
 }

4、生成条形码

static byte[] GetBarcode(int width, int height, TYPE type, string code, out Image image)
{
    Barcode b = new Barcode
        {
            //BackColor = Color.White, //图片背景颜色
            //ForeColor = Color.Black, //条码颜色
            IncludeLabel = true,
            Alignment = AlignmentPositions.CENTER,
            LabelPosition = LabelPositions.BOTTOMCENTER,
            ImageFormat = System.Drawing.Imaging.ImageFormat.Jp


http://www.mrgr.cn/news/54814.html

相关文章:

  • 什么样的JSON编辑器才好用_
  • 解决Git合并冲突:掌握版本控制的精髓
  • 类型限定符(Type qualifier)
  • Imagic: Text-Based Real Image Editing with Diffusion Models
  • WebStorm小白下载安装教程
  • QT--QPushButton设置文本和图标、使能禁能、信号演示
  • git分支操作简记
  • 设计模式总结
  • vscode默认添加python项目的源目录路径到执行环境(解决ModuleNotFoundError: No module named问题)
  • debug:vscode使用ssh连接
  • pycharm调试带参数命令行的程序
  • Linux批量创建多个文件
  • 淘系商品详情数据接口系列的详细介绍
  • 推荐一款非常好用的3d设计软件:LuBan 3D
  • 基于opencv的人脸闭眼识别疲劳监测
  • Eclipse——Java开发详解
  • java基本数据类型
  • 自动对焦爬山算法原理
  • MySQL数据库备份和恢复:全面指南与实战代码
  • 【算法】KMP字符串匹配算法
  • MySQL-28.事务-介绍与操作
  • ElasticSearch-7.17.24设置密码及CA证书
  • aaaaaaaaaa
  • scrapy案例——豆瓣电影Top250的爬取
  • python中堆的用法
  • Go_Parser部署、使用与原理分析