打印Picturebox C#的全部内容

时间:2016-06-28 05:18:08

标签: c#

所以我知道您可以使用以下方式打印图片框的图像内容:

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

要打印背景图像,我需要更改为:

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

问题是你如何打印两者?

谢谢,

2 个答案:

答案 0 :(得分:3)

先做背景:

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

答案 1 :(得分:2)

按照您的意愿操纵它。

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