我有「C://」中名稱爲「1.bmp」,「2.bmp」,「3.bmp」等位圖,我試圖打印這些圖像,但打印文檔是空的圖像是在正確的路徑)爲什麼我的圖像不能打印到PrintDocument?
這裏是我的代碼:
private void button3_Click_1(object sender, EventArgs e)
{
PrintDocument pd = new PrintDocument();
for (int indice = 0; indice < nPaginasPDF + 1; indice++)
{
pd.PrintPage += new PrintPageEventHandler(Print_Page);
}
PrintPreviewDialog dlg = new PrintPreviewDialog();
dlg.Document = pd;
dlg.ShowDialog();
pd.Print();
}
private void Print_Page(object o, PrintPageEventArgs e)
{
nPaginasImpressas++;
System.Drawing.Image i = System.Drawing.Image.FromFile("C:\\" + nPaginasImpressas + ".bmp");
Point p = new Point(891, 1350);
e.Graphics.DrawImage(i, p);
}
nPaginasImpressas.ToString()何時連接正確? – Edper 2013-04-30 14:20:02
也不起作用 – 2013-04-30 14:21:21
我試圖改變路徑var path =「C:\」+ nPaginasImpressas.ToString()+「.bmp」; 但我得到編譯錯誤 – 2013-04-30 14:28:02