猿问

C# BarcodeLib。dll 生成一维码的问题

public Image GetImage(int height,int width, BarcodeLib.TYPE type,string code)         {             Image image;             BarcodeLib.Barcode b = new BarcodeLib.Barcode();             b.BackColor = System.Drawing.Color.White;//图片背景颜色             b.ForeColor = System.Drawing.Color.Black;//条码颜色             b.IncludeLabel = true;             b.Alignment = BarcodeLib.AlignmentPositions.LEFT;             b.LabelPosition = BarcodeLib.LabelPositions.BOTTOMCENTER;//code的显示位置             b.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;//图片格式             System.Drawing.Font font = new System.Drawing.Font("verdana", 10f);//字体设置             b.LabelFont = font;             b.Height = height;//图片高度设置(px单位)             b.Width = width;//图片宽度设置(px单位)

            image = b.Encode(type,code);//生成图片             return image;

        } 

  这是 生成一维码的代码 

这个调用的时候 Image image = GetImage(100,248,TYPE.CODE128,Tmh);
             e.Graphics.DrawImage(image, 50, 300);  

 可是生成的一维码 有的一样有的不一样怎么回事 


阿波罗的战车
浏览 1178回答 2
2回答

慕容3067478

何必这么麻烦,告诉你一个简单的办法,有一种字体就是条形码字体,自动给你的编码渲染成图形条形码。

一只甜甜圈

查询一下code128的编码格式
随时随地看视频慕课网APP
我要回答