多页连续打印

int x = 20; 
int y = 20; 
while (linesPrinted<lines.Length) 
{ 
    //绘制要打印的页面 
    e.Graphics.DrawString(lines[linesPrinted++], new Font("Arial", 10), Brushes.Black, x, y); 

    y += 55; 

    //判断超过一页时,允许进行多页打印 
    if (y >= e.PageBounds.Height - 80) 
    { 
        //允许多页打印 
        e.HasMorePages = true; 

        /* 
         * PrintPageEventArgs类的HaeMorePages属性为True时,通知控件器,必须再次调用OnPrintPage()方法,打印一个页面。 
         * PrintLoopI()有一个用于每个要打印的页面的序例。如果HasMorePages是False,PrintLoop()就会停止。 
         */ 
        return; 
    } 
} 

linesPrinted = 0; 
//绘制完成后,关闭多页打印功能 
e.HasMorePages = false; 
原文地址:https://www.cnblogs.com/xinzheng/p/4527266.html