C#实现批量生成条形码 ——主要用于准考证号的条形码生成

本文介绍了一个使用C#编写的批量生成条形码的程序,支持自定义图片大小、条形码参数,并能针对准考证号进行条形码生成。程序包括设置标题字号、增量数制等功能,并提供了源代码示例。
摘要由CSDN通过智能技术生成

功能介绍

1、  批量生成条形码

2、  自由设置图片大小、条形码线高和间距

3、  自由设置标题文本字号大小

4、  自由设置增量(相邻条形码的差量)数制(比如:每考场只生成30名)

源代码

using System;

using System;

using System.Collections.Generic;

usingSystem.ComponentModel;

using System.Data;

usingSystem.Drawing;

using System.Linq;

using System.Text;

usingSystem.Windows.Forms;

usingSystem.Drawing.Imaging;

usingSystem.Collections;

usingSystem.Configuration;

using System.Text.RegularExpressions;

 

namespaceTXMApplication

{

    public partial class Form1 : Form

    {

        //条形码

        public class Code39

        {

            private Hashtable Decode;

            private Hashtable CheckCode;

            private String SPARATOR ="0";

            public int WidthCU=3 ;//粗线和宽间隙宽度

            public int WidthXI=1 ;//细线和窄间隙宽度

            public int AboveMargin;//上边距

            public int DownMargin;//下边距

            public int LeftMargin;//左边距

            public int RightMargin;//右边距

            public int FoundSize;//标题字号

            public int UseTitle;//是否有标题

            public int LineHeight;//线高

            public String PathStr;//存储路径

            private int Height = 0;//

            private int Width = 0;//

            public void Set(int a,int d,int l,int r,int s,int t,int h,String p)

            {

                AboveMargin=a;

                DownMargin=d;

                LeftMargin = l;

                RightMargin = r;

                FoundSize = s;

                UseTitle = t;

                LineHeight = h;

                PathStr = p;

               //Width=LeftMargin+RightMargin+WidthCU+WidthXI

            }

            public Code39()

            {

                Decode = new Hashtable();

                Decode.Add("0","000110100");

                Decode.Add("1","100100001");

                Decode.Add("2","001100001");

                Decode.Add("3","101100000");

                Decode.Add("4","000110001");

                Decode.Add("5","100110000");

                Decode.Add("6","001110000");

                Decode.Add("7","000100101");

                Decode.Add("8","100100100");

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值