1
我已經創建了多個映像到磁盤。我想單擊打印所有按鈕並打印所有打印的圖像。單擊一個按鈕打印多個圖像在winforms中全部打印
public void PrintGraph()
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.PrintImageHandler);
PrintDialog MyPrintDialog = new PrintDialog();
if (MyPrintDialog.ShowDialog() == DialogResult.OK)
{
pd.Print();
}
myprintDocument.Dispose();
}
處理程序是如下:
private void PrintImageHandler(object sender, PrintPageEventArgs ppeArgs)
{
Graphics g = ppeArgs.Graphics;
for (int i = 0; i < lstAllImages.Count; i++)
{
Image objimage = Image.FromFile(lstAllloadImages[i].ToString());
g.DrawImage(objimage, 0, 0, objimage.Width, objimage.Height);
} // Draw Image using the DrawImage method
}
只有一個圖像打印。 我想打印多個圖像,點擊打印所有按鈕。
有沒有可能每頁打印兩個圖像? – user990897
@ user990897 - 是的,當然,但是你不希望''DrawImage()'他們都在'0,0'位置(否則,你仍然是一個在另一個之上繪製,而最後一個畫出來會「贏」) –
這是正確的嗎?圖形g = ppeArgs.Graphics; Image objimage = Image.FromFile(lstAllImages [currentPage] .ToString()); if(currentPage%2 == 0){g.DrawImage(objimage,0,0,objimage.Width,objimage.Height); } else {g.DrawImage(objimage,0,600,objimage.Width,objimage.Height);當前頁++; } ppeArgs.HasMorePages = currentPage
user990897