关于打印换页
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e){
int height = e.PageSettings.Bounds.Height; //打印页的高度
float hs = height / 3 + 1; //标签高度
int count = dv1.Rows.Count;
while (x <= count - 1)
{
for (y = 0; y <= 2; y++)
{
e.Graphics.DrawString(Convert.ToString(dv1.Rows[x].Cells[y].Value), new Font("宋体", 20, FontStyle.Regular), Brushes.Black, 0, y * hs);
if (y == 2)
{
e.HasMorePages = true;
return;
}
else
e.HasMorePages = false;
}
x++;
}
我要实现gridview一行打一页,gridview每行的三列在一页之中分三行打印
打印预览的时候,他不断增加新页是怎么回事?就是打印页不断增加,没有终结 --------------------编程问答-------------------- private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
int height = e.PageSettings.Bounds.Height; //打印页的高度
float hs = height / 3 + 1; //标签高度
int count = dv1.Rows.Count;
while(x <= count - 1)
{
for (y = 0; y <= 2; y++)
{
e.Graphics.DrawString(Convert.ToString(dv1.Rows[x].Cells[y].Value), new Font("宋体", 20, FontStyle.Regular), Brushes.Black, 0, y * hs);
}
if (y == 2)
{
e.HasMorePages = true;
return;
}
else
e.HasMorePages = false;
x++;
}
}
做了如下改变,结果不新增加页,把所有的页面都打到一页上了
补充:.NET技术 , C#