我要打印一组图片,自己写了document类,里面循环读取图片组的图片,然后用Graphics画出,循环可以执行,但是预览和打印却只能显示第一张图片,详细地说就是預覽的時候只有一张A4纸,纸上只顯示了第一张圖片,沒有出現圖片组的圖片叠加顯示在一张纸上的情况,想问一下,是哪里出了問題,具體代碼如下.在线等,解决就給分
public class ImagePrintDocument : PrintDocument
{
private Image[] document;
public ImagePrintDocument(Image[] doc)
{
this.document=doc;
}
protected override void OnPrintPage(PrintPageEventArgs e)
{



for(int i=0;i<document.Length;i++)
{
Image a=document[i];
Rectangle rcImage=new Rectangle(0,0,0,0);
rcImage.X=(int)e.MarginBounds.X;
rcImage.Width=a.Width;
rcImage.Y=0+(int)(20+a.Height)*i;
rcImage.Height=a.Height;
e.Graphics.DrawImage(a,rcImage,0,0,a.Width,a.Height,GraphicsUnit.Pixel);
if(i>=document.Length-1)
{
e.HasMorePages = false;
}
else
{
e.HasMorePages = true;
}

}
}
}