C#里打印第二页功能要怎么实现,有什么可以用得上的方法吗?

2025-02-22 05:46:40
推荐回答(2个)
回答1:

你可以单独复制以下代码到项目中试试,其实主要是 e.HasMorePages的运用。表示是否另开一页。

int i = 0;
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
if (i == 0)
{
i++;
e.Graphics.DrawString("asdfsdf", this.Font, new SolidBrush(Color.Red), new PointF(20f, 20f));
e.HasMorePages = true;
}
else
{
e.Graphics.DrawString("ac", this.Font, new SolidBrush(Color.Red), new PointF(50f, 50f));

e.HasMorePages = false;
}
}

private void button1_Click(object sender, EventArgs e)
{
printDialog1.Document = printDocument1;
printDocument1.DocumentName = "2";
if (DialogResult.OK == printDialog1.ShowDialog())
{
printDocument1.Print();
}

}

回答2:

不知道你的批量打印是什么意思,是多页打印还是什么呢?如果想批量打印可以使用微软报表的分组打印,这个在一定程序上可以实现批打,我就是刚刚用过这个功能的!还是比较简单的!