我遇到多页打印问题。我想使用方法e.HasMorePages
打印文章列表。 PrintpreviewDialog 显示我想要打印的内容,但是当我打印时,列表还没有打印出来。
int Q = 0;
int Z = 1100;
int letter= 13;
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
int X = 40; int Y = 150;
//draw text that appear in print preview dialog and print page
Y = 180;
//draw text which appear in print preview dialog and print page
Y = 210;
for (int i = Q; i < listBox1.Items.Count; i++)
{
Q++;
//draw text wicih appear in print preview but doesn't in print page
Y = Y + 30;
if ((Y >= Z))
{
e.HasMorePages = true;
Y = 180;
return;
}
else
{
e.HasMorePages = false;
}
}
}
这显示了PrintPreviewDialog:
这是打印输出: