NothinRandom
NothinRandom

Reputation: 235

Print Full Content of Picturebox C#

So I know that you can print the image content of a picture box using:

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
    e.Graphics.DrawImage(pictureBox1.Image, 0, 0);
}

To print the background image, I will need to change to:

e.Graphics.DrawImage(pictureBox1.BackgroundImage, 0, 0);

Question is how do you print both?

Thanks,

Upvotes: 1

Views: 850

Answers (2)

Zein Makki
Zein Makki

Reputation: 30032

Just do the background first:

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
    e.Graphics.DrawImage(pictureBox1.BackgroundImage, 0, 0);
    e.Graphics.DrawImage(pictureBox1.Image, 0, 0);
}

Upvotes: 3

Abdul Rehman Sayed
Abdul Rehman Sayed

Reputation: 6672

Manipulate it as you wish..

Bitmap bmp = new Bitmap (500,500);
pictureBox1.DrawToBitmap(bmp, pictureBox1.DisplayRectangle);
bmp.Save("C:\\abcd.jpg");

Upvotes: 2

Related Questions