其实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