本文介绍了将条形码转换为图像文件格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我正在使用某些类从我的应用程序中创建条形码,它可以正常工作,
但是我将条形码转换为图像文件格式,但是这样做时条形码读取器无法读取,
但是如果我的条形码位于文本文件中,则条形码读取器可以读取相同的数据
我不知道如何解决此问题,请让我知道您的想法和一些示例代码
这是我转换条形码图像格式的代码;
hi all i am creating barcode from my application by using some class''s,its working fine,
but i am converting my barcode into image file format, when i do so, its not reading by barcode reader,
but if my barcode is in text file, barcode reader is reading fine the same data
i don''t know how to fix this issue,please let me know your thoughts and some sample code for it
this is my code for converting barcode image format;
Color BackColor = Color.White;
String FontName = "IDAutomationSC128M DEMO";
string Fontaname1 = "ARIAL";
int FontSize = 11;
int fontSize1 = 8;
int Height2 = 80;
int Width2 = 175;
string a,b,c;
IDAutomationBarcodeObject = new clsBarCode();
a = IDAutomationBarcodeObject.Code128(txtEnter.Text, true);
b = "Some Sample Name";
c = "Product Description";
Bitmap bitmap = new Bitmap(Width2, Height2);
Graphics graphics = Graphics.FromImage(bitmap);
Color color = Color.Gray; ;
Font font = new Font(FontName, FontSize);
Font Font1 = new Font(Fontaname1, fontSize1);
SolidBrush BrushBackColor = new SolidBrush(BackColor);
Pen BorderPen = new Pen(color);
Rectangle displayRectangle1 = new Rectangle(new Point(0, 0), new Size(Width2 - 1, Height2 - 2));
graphics.FillRectangle(BrushBackColor, displayRectangle1);
graphics.DrawString(b, Font1, Brushes.Black, 0, 0);
graphics.DrawString(a, font, Brushes.Black, 4, 15);
graphics.DrawString(c, Font1, Brushes.Black, 0, 63);
pictureBox1.Image = bitmap;
bitmap.Save("c:\\button11.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
推荐答案
这篇关于将条形码转换为图像文件格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!