I need help printing the form. I used the ControlPrinter class How to use PrintDocument with a scrollable Panel? , I didn't make any changes to it, and it only prints the background of the form anyway.Please advise me what I did wrong. Thank you in advance
private void button1_Click(object sender, EventArgs e)
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.printDocument1_PrintPage);
pd.Print();
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
var bitmap = ControlPrinter.ScrollableControlToBitmap(this, true, true);
e.Graphics.DrawImage(bitmap, 0, 0);
}