2016-06-28 93 views
1

所以我知道,你可以使用打印图片框的图像内容:打印全部内容

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

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

​​

问题是你怎么打印两个?

感谢,

+0

你说的打印都意味着,你想要的图片合并在相同的图像?或者你想一个接一个地打印它们。 – Ogbe

+0

@ozioma都合并到相同的图像。我认为这个问题已经得到解答。 – NothinRandom

回答

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

这会打印在一张纸上吗?我对这两个都感兴趣。 – NothinRandom

+0

那么,如果你先打印背景,'Image'将被打印在背景之上。 – Darkrifts

+0

@NothinRandom我试图在窗体上绘制它,它工作,只是试一试。 – user3185569

2

操纵它,你想..

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

嘿阿卜杜勒。那么这将如何帮助打印背景图像和图像? – NothinRandom

+0

它同时打印两个..你得到一个组合的图像 –

+1

事实上'DrawToBitmap' __also__结合了这两个图像与任何你__draw__表面上的'Paint'事件..!当然,你不需要保存它;只需在'PrintPage'事件中将'DrawImage'作为'bmp'。 - 还要注意,它将图像组合在一起,即不缩放,并具有相同的dpi分辨率! – TaW