代码如下:
private void button7_Click(object sender, EventArgs e)
{
    PrintDocument pd = new PrintDocument();
    pd.PrintPage += new PrintPageEventHandler(this.printDocument1_PrintPage);
    //pd.Print();    printPreviewDialog1.Document = this.printDocument1;
    printPreviewDialog1.ShowDialog();
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
    try
    {
        BitmapList1 = GetBitmapList();
        pictureBox1.Image = BitmapList1[0];
        Bitmap bitmap = null;        for (int i = 0; i < BitmapList1.Count; i++)
        {
            bitmap = BitmapList1[i];
            e.Graphics.DrawImage(bitmap, 0, (200 * i) + 5, 200, 200);
        }
    }
    catch (Exception ee)
    {
        MessageBox.Show(ee.Message);
    }
}

解决方案 »

  1.   

    第一页:
    e.HasMorePages = true;  // 还有下页第二页:
    e.HasMorePages = false; // 最后一页
      

  2.   

    Quote: 引用#1:

            for (int i = 0; i < BitmapList1.Count; i++)
            {
                bitmap = BitmapList1[i];
                e.Graphics.DrawImage(bitmap, 0, (200 * i) + 5, 200, 200);
            }
    Quote:
    你自己的代码定位画图,还不知道该那里换页?
      

  3.   

    我用了两个变量,但是还是实现不了,不知道该怎么写,求救
    private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
    {
        #region
        try
        {
            BitmapList1 = GetBitmapList();
            pictureBox1.Image = BitmapList1[0];
            Bitmap bitmap = null;        iPageCount = (BitmapList1.Count / 6) + 1;        for (int i = 0; i < BitmapList1.Count; i++)
            {
                bitmap = BitmapList1[i];
                  e.Graphics.DrawImage(bitmap, 0, (200 * i) + 2, 200, 200);        
              }
        }
        catch (Exception ee)
        {
            MessageBox.Show(ee.Message);      //提示对话框
         }
        #endregion
        if (iCurrentPage < iPageCount)
        {
            e.HasMorePages = true;
            iCurrentPage++;
        }
        else
        {
            e.HasMorePages = false;
        }
    }
      

  4.   


    小弟你还是用FastReport来打印吧,想怎么排就怎么排实现起来容易的很。
      

  5.   

    for (int i = 0; i < BitmapList1.Count; i++)//这里要修改成iPageCount吧
      

  6.   

    首选确定你要打印时一页要显示几个,然后根据取出数据的总值除以设置一页显示几个则剩下的就是有多少打印页面int printcount=dt.rows.count/20;20就是打印显示的多少个。 iPageCount = (BitmapList1.Count / 6) + 1;
      for (int i = 0; i < BitmapList1.Count; i++)
    》改成下面的
     iPageCount = (BitmapList1.Count / 6) + 1;
      for (int i = 0; i <iPageCount ; i++){} 试试
      

  7.   

    for (int i = 0; i <iPageCount ; i++){} 改成这样后,打印出是两张,但是两张都是第二页的部份。
    第一页没有打印。
      

  8.   

    高手帮帮忙呀,for (int i = 0; i <iPageCount ; i++){} 这样改后,我这里只有2页,那不是只循环两次了吗,那每一页打印6个码图,这个不用循环吗。
      

  9.   


    显然要啊你这个是form做的?为什么不用水晶报表呢?那样打印的部分就不用自己写了