简体   繁体   中英

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,

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);
}

Manipulate it as you wish..

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM