我尝试了下面给出的代码,但它不打印网格内容,只打印边框。
任何帮助都将受到高度赞赏。
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();
}