基本信息
源码名称:C# 批量生成二维码工具
源码大小:2.19M
文件格式:.zip
开发语言:C#
更新时间:2020-10-27
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍

二维码生成


using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace CreateQrCode
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnbeijing_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog path = new FolderBrowserDialog();
            path.ShowDialog();
            txtbeijing.Text= path.SelectedPath;
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog path = new FolderBrowserDialog();
            path.ShowDialog();
            txtSaveQrCode.Text= path.SelectedPath; 
        }

        private void btnCreate_Click(object sender, EventArgs e)
        {
            string bj = txtbeijing.Text;
            string save = txtSaveQrCode.Text;
            if (bj == "") {
                MessageBox.Show("请设置背景图片地址", "");
                return;
            }
            if (save == "") {
                MessageBox.Show("请设置保存地址", "");
                return;
            }
            int size= int.Parse(txtSize.Text);
            int num = int.Parse(txtNum.Text);
           
            if (num==0) {
                MessageBox.Show("请确定生成二维码数量", "");
                return;
            }
            btnCreate.Enabled = false;
            bj = bj   "\\";
            save = save   "\\";
            int codeId = int.Parse(txtStart.Text);         
           
            int lblstart = 0;//生成数量
            for (int i = 0; i < num; i  )
            {
                string no = "";
                codeId  ;
                if (codeId > 10000000)
                {
                    no = codeId.ToString();
                }
                else
                {
                    no = codeId.ToString().PadLeft(8, '0');
                }
                var ret = "http://www.baidu.com?sid="   no;
                string addressNo = "编号:"   no;
                string fileName = no   ".png";
                string filePath = save   fileName;
                if (System.IO.File.Exists(filePath))//二维码是否存在
                {
                    System.IO.File.Delete(filePath);
                }
                var savePath = save;

                string img = "model.jpg";
                          
               var logoPath = bj   img;//生成的背景图
                string logo = bj "logo.png";//logo
                System.Drawing.Bitmap logoImg = Utils.CreateQRCodeWithLogo(ret, logo,size);
                QRCoderHelper.CreateQRCodeJob(logoImg, addressNo, logoPath, savePath, fileName, logo);
                lblstart  ;               
            }
            MessageBox.Show("生成成功", "");
            lblCount.Text = lblstart.ToString();
            btnCreate.Enabled = true;
        }

    }
}