HasMorePages导致打印不正确

时间:2017-01-05 18:44:10

标签: c# printing

我遇到多页打印问题。我想使用方法e.HasMorePages打印文章列表。 PrintpreviewDialog 显示我想要打印的内容,但是当我打印时,列表还没有打印出来。

这是我的代码:

    int Q = 0;
    int Z = 1100;        
    int letter= 13;        




private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
    {

        int X = 40; int Y = 150;

        //draw text that appear in print preview dialog and print page            

        Y = 180;

        //draw text which appear in print preview dialog and print page

        Y = 210;
        for (int i = Q; i < listBox1.Items.Count; i++)
        {
            Q++;                
            //draw text wicih appear in print preview but doesn't in print page

            Y = Y + 30;                
            if ((Y >= Z)) 
            {
                e.HasMorePages = true;
                Y = 180;
                return;
            }
            else
            {
                e.HasMorePages = false;

            }
        }
    }

这显示了PrintPreviewDialog: printpreviewDialog

这是打印输出:

print output

0 个答案:

没有答案