C#把数字转化成条形码

其实Windows本身就有一个字体是用来显示条形码的。
只要将数字改为这种字体就变成了条形码。

windows字体库下,有如下八种字体可以用来将数字转换成条形码:
Code39AzaleaNarrow1
Code39AzaleaNarrow2
Code39AzaleaNarrow3
Code39AzaleaRegular1
Code39AzaleaRegular2
Code39AzaleaWide1
Code39AzaleaWide2
Code39AzaleaWide3

把代码贴给大家参考:

复制代码 代码如下:
Bitmap b=new Bitmap(200,200); 
Graphics g = Graphics.FromImage(b); 
Font font = new Font("Code39AzaleaRegular2", 32); 
g.DrawString("123456", font, Brushes.Black, new PointF(100,100));  
pictureBox1.BackgroundImage = b;
pictureBox1.BackgroundImageLayout = ImageLayout.Zoom 

猜你喜欢

转载自blog.csdn.net/qq_39353597/article/details/78465071