日期:2014-05-18  浏览次数:20780 次

做过条形码的进
使用了BarTender插件 一直有问题  

请教各位怎么搞定条形码的??????????????

------解决方案--------------------
http://blog.163.com/swim_fish/blog/static/190899302201161951915904/
http://www.cnblogs.com/xmonkey2001/archive/2009/11/10/1600084.html
------解决方案--------------------
我每次都是从数据库里面将那些条码值读取出来,然后打印。BarTender里面可以设置打印的数据源(有文本文件,数据库文件等等),很简单的。

你说的打印第一个是什么意思?难道是只打印 dt.Rows.Add("a123456")?
------解决方案--------------------
btw = @"D:\Bartend\1.btw";
Process.Start(bartendAdd, "/NOSPLASH /F=\"" + btw + "\" /D=\"" + sn + "\" /P /X");
------解决方案--------------------
你可以参考一下 www.qxexpress.com
------解决方案--------------------
你是需要生成二维码还是一维码?
------解决方案--------------------
C# code


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BarCodeTest
{
    public partial class Form4 : Form
    {
        public Form4()
        {
            InitializeComponent();
            this.Paint += new PaintEventHandler(Form4_Paint);
        }

        void Form4_Paint(object sender, PaintEventArgs e)
        {
            Rectangle barcoderect = new Rectangle(10, 10, 250, 48);
            BarCode39 barcode = new BarCode39();
            barcode.BarcodeText = "69555555555555";
            
            barcode.DrawBarcode(e.Graphics, barcoderect);
        }
    }


/********************************分割线***********************************/


    public class BarCode39
    {
        public string BarcodeText = string.Empty;

        public int BarcodeHeight = 0;
        public int BarcodeWidth = 0;

        public Font footerFont = new Font("微软雅黑", 12.0f);   /*修改了字体大小*/

        private double wideToNarrowRatio = 3.0;

        public double WideToNarrowRatio
        {
            get { return wideToNarrowRatio; }
            set { wideToNarrowRatio = value; }
        }
        private int weight = 1;

        public int Weight
        {
            get { return weight; }
            set { weight = value; }
        }
        /// <summary>
        /// 39条码中能使用的字符
        /// </summary>
        private String alphabet39 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*";

        private String[] coded39Char = 
        {
            /* 0 */ "001100100", 
            /* 1 */ "100010100", 
            /* 2 */ "010010100", 
            /* 3 */ "110000100",
            /* 4 */ "001010100", 
            /* 5 */ "101000100", 
            /* 6 */ "011000100", 
            /* 7 */ "000110100",
            /* 8 */ "100100100", 
            /* 9 */ "010100100", 
            /* A */ "100010010", 
            /* B */ "010010010",
            /* C */ "110000010", 
            /* D */ "001010010", 
            /* E */ "101000010", 
            /* F */ "011000010",
            /* G */ "000110010", 
            /* H */ "100100010", 
            /* I */ "010100010", 
            /* J */ "001100010",
            /* K */ "100010001", 
            /* L */ "010010001", 
            /* M */ "110000001", 
            /* N */ "001010001",
            /* O */ "101000001", 
            /* P */ "011000001", 
            /* Q */ "000110001", 
            /* R */ "100100001",
            /* S */ "010100001", 
            /* T */ "001100001", 
            /* U */ "100011000",