110,537
社区成员
发帖
与我相关
我的任务
分享
private void PrintReceipt()
{
//printFont = new Font("宋体", 10);
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
StandardPrintController spc = new StandardPrintController();
pd.PrintController = spc;
pd.Print();
}
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
Font printFont = new Font("宋体", 8);
float linesPerPage = 0;
int lineCount = 0;
float lineWidth = ev.MarginBounds.Width ;
RectangleF lineRectangleF = new RectangleF(new PointF(0, 0), new SizeF(lineWidth, printFont.GetHeight(ev.Graphics)));
ev.Graphics.DrawString("《小鸡鸡》", new Font("宋体", 10), Brushes.Black, lineRectangleF, formatTitle);
foreach (DataRow row in Gridview.Rows)
{
ev.Graphics.DrawString(“大鸟鸟”, printFont, Brushes.Black, lineRectangleF, new StringFormat());
}
}