无法通过打印机打印数据网格的内容

时间:2017-10-26 06:35:34

标签: c# winforms printing datagridview

我尝试了下面给出的代码,但它不打印网格内容,只打印边框。

任何帮助都将受到高度赞赏。

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
    Bitmap dataGridViewImage = new Bitmap(this.tickGridBulkAssign.Width, this.tickGridBulkAssign.Height);

    tickGridBulkAssign.DrawToBitmap(dataGridViewImage, new Rectangle(0, 0, this.tickGridBulkAssign.Width, this.tickGridBulkAssign.Height));

    e.Graphics.DrawImage(dataGridViewImage, 0, 0);
}

protected override void toolBarButtonPrint_Click()
{
    printDocument1.Print();
}

0 个答案:

没有答案