I'm using WinForms. I'm have 2 forms. In form1 i have a picturebox and in form2 i have a button that prints. I'm trying to build an application that will print the images from the picturebox in Form1 using Form2.
I first tried making a panel and testing if the pictures would print in form1, and it did, but the problem is when copied the printing code to form2, the code wouldn't let me access the picturebox in form1.
How do i access the picturebox in Form1 from Form2 so i cant print the images in the picturebox.
I receive error lines under this.pictureBox1.
Form2
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
var bmp = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height);
this.pictureBox1.DrawToBitmap(bmp, this.pictureBox1.ClientRectangle);
e.Graphics.DrawImage(bmp, 25, 25, 800, 1050);
}