I am faced with the problem that I do not know how to transfer data that does not fit on one sheet. if necessary, here is my source code
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
float scale = 0.75f;
float width = e.MarginBounds.Width * scale;
float height = e.MarginBounds.Height * scale;
Bitmap bitmap = new Bitmap(dataGridView1.Width, dataGridView1.Height);
dataGridView1.DrawToBitmap(bitmap, new Rectangle(0, 0, dataGridView1.Width, dataGridView1.Height));
e.Graphics.DrawImage(bitmap, new Rectangle(0, 0, (int)(bitmap.Width * scale), (int)(bitmap.Height * scale)));
e.HasMorePages = false;
}
private void button3_Click(object sender, EventArgs e)
{
try
{
printDocument1.DefaultPageSettings.Landscape = true;
dataGridView1.ClearSelection();
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.PrintPreviewControl.Zoom = 1;
printPreviewDialog1.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}