首先条码打印机和扫描枪都是没有问题的,用条码打印机自带的软件做的条码都能扫描,自己生成的却不的行,我换了其它格式的也不行,help一下!! private System.Drawing.Printing.PrintDocument printDocument1;
private void Form1_Load(object sender, EventArgs e)
{
axBarCodeCtrl1.Value = "BM1159999"; printDocument1 = new System.Drawing.Printing.PrintDocument();
printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printDocument1_PrintPage);
}
Bitmap memorybitmap;
/// <summary>
/// 导出条码为bmp
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
try
{
Graphics g = axBarCodeCtrl1.CreateGraphics();
memorybitmap = new Bitmap(axBarCodeCtrl1.Size.Width, axBarCodeCtrl1.Size.Height, g);
g = Graphics.FromImage(memorybitmap);
g.CopyFromScreen(this.Location.X + axBarCodeCtrl1.Location.X, this.Location.Y + axBarCodeCtrl1.Location.Y + SystemInformation.CaptionHeight, 0, 0, this.Size);
memorybitmap.Save(@"d:\Barcode\b.bmp");//保存为图片
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(printBmp, new Point(0, 0));
} Bitmap printBmp;
/// <summary>
/// 打印条码
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
try
{
Graphics g = axBarCodeCtrl1.CreateGraphics();
printBmp = new Bitmap(axBarCodeCtrl1.Size.Width, axBarCodeCtrl1.Size.Height, g);
g = Graphics.FromImage(printBmp);
g.CopyFromScreen(this.Location.X + axBarCodeCtrl1.Location.X, this.Location.Y + axBarCodeCtrl1.Location.Y + SystemInformation.CaptionHeight, 0, 0, this.Size); printDocument1.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
} }
private void Form1_Load(object sender, EventArgs e)
{
axBarCodeCtrl1.Value = "BM1159999"; printDocument1 = new System.Drawing.Printing.PrintDocument();
printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printDocument1_PrintPage);
}
Bitmap memorybitmap;
/// <summary>
/// 导出条码为bmp
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
try
{
Graphics g = axBarCodeCtrl1.CreateGraphics();
memorybitmap = new Bitmap(axBarCodeCtrl1.Size.Width, axBarCodeCtrl1.Size.Height, g);
g = Graphics.FromImage(memorybitmap);
g.CopyFromScreen(this.Location.X + axBarCodeCtrl1.Location.X, this.Location.Y + axBarCodeCtrl1.Location.Y + SystemInformation.CaptionHeight, 0, 0, this.Size);
memorybitmap.Save(@"d:\Barcode\b.bmp");//保存为图片
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(printBmp, new Point(0, 0));
} Bitmap printBmp;
/// <summary>
/// 打印条码
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
try
{
Graphics g = axBarCodeCtrl1.CreateGraphics();
printBmp = new Bitmap(axBarCodeCtrl1.Size.Width, axBarCodeCtrl1.Size.Height, g);
g = Graphics.FromImage(printBmp);
g.CopyFromScreen(this.Location.X + axBarCodeCtrl1.Location.X, this.Location.Y + axBarCodeCtrl1.Location.Y + SystemInformation.CaptionHeight, 0, 0, this.Size); printDocument1.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
} }
编码 大小
有的条码格式默认会加上*号的,code-128的是不带*号的。
这个怎么讲? 是指扫描抢支持的格式种类吗? 我用它自带的软件随便做个code-128的条形码,还是可以扫描出来的。
图传错了,上面是code-39的,一样也扫不出来。。