条形码 BarCode (C# BarcodeLib.dll)

1  static  void  BuildBarcode()
2        {
3            System.Drawing.Image image;
4            int width=250, height=100;
5            byte[] buffer = GetBarcode(height, width, 
6                     BarcodeLib.TYPE.CODE128, "Avx-(13614)-vR", out image);
7        }
 1      static byte[] GetBarcode(int height, int width,BarcodeLib.TYPE type,
 2                                           string  code,out System.Drawing.Image image)
 3         {
 4             image=null;
 5             BarcodeLib.Barcode b = new BarcodeLib.Barcode();
 6             b.BackColor = System.Drawing.Color.White;
 7             b.ForeColor = System.Drawing.Color.Black;
 8             b.IncludeLabel = true;
 9             b.Alignment = BarcodeLib.AlignmentPositions.CENTER;
10             b.LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER;
11             b.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
12             System.Drawing.Font font = new System.Drawing.Font("verdana",10f);
13             b.LabelFont = font;
14 
15             b.Height = height;
16             b.Width = width;
17 
18             image = b.Encode(type, code);
19             SaveImage(image, Guid.NewGuid().ToString("N")+".png");
20             byte[] buffer = b.GetImageData(SaveTypes.GIF);
21             return buffer;
22         }
生成的条形码:

[barcode.dll下载]

转载于:https://www.cnblogs.com/AspDotNetMVC/archive/2012/11/16/2767576.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值