请问在C#中的RichTextBox怎样做到像银行打印存折那样的一页续打功能?
请问在C#中怎样做到像银行打印存折那样的一页续打功能?就是一页没有打完,继续接着打。c#的RichTextBox能够实现该功能吗?水晶报表可以吗?希望能够给出源代码,谢谢...
请问在C#中怎样做到像银行打印存折那样的一页续打功能?就是一页没有打完,继续接着打。c#的RichTextBox能够实现该功能吗?水晶报表可以吗?希望能够给出源代码,谢谢
展开
2个回答
展开全部
c#的打印程序结构一般如:
public void Print(DCMission ptmission)
{
//set cur
mission = ptmission;
//print
PrintDocument ptdoc = new PrintDocument();
ptdoc.DocumentName = mission.document_name;
ptdoc.PrinterSettings.PrinterName = printer_name;
ptdoc.PrintPage += new PrintPageEventHandler(PrintPage);
ptdoc.PrintController = new StandardPrintController();
if (ptdoc.PrinterSettings.IsValid)
{
ptdoc.Print();
}
else
{
throw new Exception("打印机" + printer_name + "不合法");
}
}
private void PrintPage(object sender, PrintPageEventArgs ev)
{
float X = 0;
float Y = 0;
for (int i = 0; i < mission.lines.Count; i++)
{
DCPTLine ptline = (DCPTLine)mission.lines[i];
ev.Graphics.DrawString(ptline.content, ptline.font, ptline.color, X, Y, new StringFormat());
Y += ptline.font.GetHeight(ev.Graphics);
}
ev.HasMorePages = false;
}
对于你的业务,在PrintPage里判断当前能否进行打印(有无内容,存折有无空间,翻到下页没有),并设置ev.HasMorePages为适当值。
public void Print(DCMission ptmission)
{
//set cur
mission = ptmission;
PrintDocument ptdoc = new PrintDocument();
ptdoc.DocumentName = mission.document_name;
ptdoc.PrinterSettings.PrinterName = printer_name;
ptdoc.PrintPage += new PrintPageEventHandler(PrintPage);
ptdoc.PrintController = new StandardPrintController();
if (ptdoc.PrinterSettings.IsValid)
{
ptdoc.Print();
}
else
{
throw new Exception("打印机" + printer_name + "不合法");
}
}
private void PrintPage(object sender, PrintPageEventArgs ev)
{
float X = 0;
float Y = 0;
for (int i = 0; i < mission.lines.Count; i++)
{
DCPTLine ptline = (DCPTLine)mission.lines[i];
ev.Graphics.DrawString(ptline.content, ptline.font, ptline.color, X, Y, new StringFormat());
Y += ptline.font.GetHeight(ev.Graphics);
}
ev.HasMorePages = false;
}
对于你的业务,在PrintPage里判断当前能否进行打印(有无内容,存折有无空间,翻到下页没有),并设置ev.HasMorePages为适当值。
展开全部
public void Print(DCMission ptmission)
{
//set cur
mission = ptmission;
//print
PrintDocument ptdoc = new PrintDocument();
ptdoc.DocumentName = mission.document_name;
ptdoc.PrinterSettings.PrinterName = printer_name;
ptdoc.PrintPage += new PrintPageEventHandler(PrintPage);
ptdoc.PrintController = new StandardPrintController();
if (ptdoc.PrinterSettings.IsValid)
{
ptdoc.Print();
}
else
{
throw new Exception("打印机" + printer_name + "不合法");
}
}
private void PrintPage(object sender, PrintPageEventArgs ev)
{
float X = 0;
float Y = 0;
for (int i = 0; i < mission.lines.Count; i++)
{
DCPTLine ptline = (DCPTLine)mission.lines[i];
ev.Graphics.DrawString(ptline.content, ptline.font, ptline.color, X, Y, new StringFormat());
Y += ptline.font.GetHeight(ev.Graphics);
}
ev.HasMorePages = false;
}
对于你的业务,在PrintPage里判断当前能否进行打印(有无内容,存折有无空间,翻到下页没有),并设置ev.HasMorePages为适当值。
{
//set cur
mission = ptmission;
PrintDocument ptdoc = new PrintDocument();
ptdoc.DocumentName = mission.document_name;
ptdoc.PrinterSettings.PrinterName = printer_name;
ptdoc.PrintPage += new PrintPageEventHandler(PrintPage);
ptdoc.PrintController = new StandardPrintController();
if (ptdoc.PrinterSettings.IsValid)
{
ptdoc.Print();
}
else
{
throw new Exception("打印机" + printer_name + "不合法");
}
}
private void PrintPage(object sender, PrintPageEventArgs ev)
{
float X = 0;
float Y = 0;
for (int i = 0; i < mission.lines.Count; i++)
{
DCPTLine ptline = (DCPTLine)mission.lines[i];
ev.Graphics.DrawString(ptline.content, ptline.font, ptline.color, X, Y, new StringFormat());
Y += ptline.font.GetHeight(ev.Graphics);
}
ev.HasMorePages = false;
}
对于你的业务,在PrintPage里判断当前能否进行打印(有无内容,存折有无空间,翻到下页没有),并设置ev.HasMorePages为适当值。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询