之前写过一个“C#WinForm程序中选择打印机打印”的文章,但在使用过程中,尤其是生成Word文档时,会感觉系统响应较慢。如果不需要留存打印文档的电子版,可以使用下面的类直接打印。相比之前的方法,这种方法更简单,可以绘制文字、线段、图片。
打印响应速度很快,比之前的方法更好用。
需要引用:
using System.Drawing;
using System.Drawing.Printing;
public class PrnBill
{
private Font titleFont;//标题字体;
private Font font;//正文字体
private Font smallFont; //小字体;
private PrintDocument printDoc;
// 使用的打印机名称
private string printerName;
public string PrinterName
{
get { return printerName; }
set { printerName = value; }
}
// 打印份数
private short copies;
public short Copies
{
get { return copies; }
set { copies = value; }
}
//标题内容
private string ti

最低0.47元/天 解锁文章
1203

被折叠的 条评论
为什么被折叠?



