I have a windows form that contains a table, two labels above it and many other components underneath By using the PrintDocument I would like to print the table with its title, and only that without showing the other components. This is my form
The code I use prints the table only.
Bitmap printImage;
private void CaptureScreen()
{
printImage = new Bitmap(tableLayoutPanel1.Width, tableLayoutPanel1.Height);
tableLayoutPanel1.DrawToBitmap(printImage, new Rectangle(0, 0, printImage.Width, printImage.Height));
}
private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawImage(printImage, 0, 0);
}
How do I combine the label?