我在“C://”中有位图,名称为“1.bmp”、“2.bmp”、“3.bmp”等,我正在尝试打印这些图像但打印文档是空的(图像是在正确的路径)
这是我的代码:
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);
}