2016-06-28 98 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