如何打印条形码 [英] How to Print a barcode

查看:79
本文介绍了如何打印条形码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作Windows窗体应用程序以在书籍上打印条形码.我已经生成了条形码并将其显示在图片框中,但是我对如何打印此图像一无所知.我在图像对象中有条形码.

请帮我.要求是我要将此图像打印在文档上的特定位置,因为在各种书籍上,条形码的位置可能会有所不同.

谢谢...

I am making a Windows Form Application to print barcodes on books. I have generated the barcode and displayed it in a Picture Box but I do not have any idea of how to print this Image. I have the barcode in an Image Object.

Please help me. The requirement is that I want to print this image at a specific position on a document because on various books the location of barcode can vary.

Thanks...

推荐答案

您可以使用类System.Drawing.Printing.PrintDocument并直接打印PictureBox实例的Image.此类的想法是从类PrintPageEventArgs的事件参数中获取System.Drawing.Graphics的实例.您可以使用方法System.Drawing.Graphics.DrawImage.

请在此处查看代码示例:
http://msdn.microsoft.com/en-us/library/system. drawing.printing.printdocument.aspx [ ^ ].

另请参见:
http://msdn.microsoft.com/en-us/library/system.drawing. graphics.aspx [^ ].

—SA
You can use the class System.Drawing.Printing.PrintDocument and print the Image of your instance of the PictureBox directly. The idea of this class is to get the instance of System.Drawing.Graphics from the event arguments of the class PrintPageEventArgs. You can use the method System.Drawing.Graphics.DrawImage.

Please see the code sample here:
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx[^].

See also:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.aspx[^].

—SA


此处是CodeProject上的一篇文章,应带您逐步了解您想要的内容.参考:打印WinForms用户控件 [
Here is an article on CodeProject that should walk you through what you want. Ref: Print a WinForms User Control[^]


这篇关于如何打印条形码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆