0
我正在尝试通过制作位图图像来打印Datagridview,它的工作很好,但它只能在1页打印。在Winform C中打印DataGridView#
这里是DataGirdView图片:
打印预览图像:
在这里打印预览不具有总行到最后作为DataGridView中的排,只有1页
印刷的代码:
private void Btn_Print_Click(object sender, EventArgs e)
{
int height = DGV.Height;
DGV.Height = DGV.RowCount * DGV.RowTemplate.Height * 2;
bmp = new Bitmap(DGV.Width, DGV.Height);
DGV.DrawToBitmap(bmp, new Rectangle(0, 0, DGV.Width, DGV.Height));
DGV.Height = height;
printPreviewDialog1.ShowDialog();
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawImage(bmp, 0, 0);
}
为什么超过1页不打印数据?代码中有错吗?请给点建议
谢谢。