我是调用API添加了自定义纸张,计算后每页应显示30行,
     预览正常,可打印时,后10行却打不出来,最后一行只打出来一半.少的行也没有到下页去,
     下一页的开头打印正常,代码如下.
                       为什么?请前辈指点.
//DBPaperSize 是调用API添加自定义纸张类
            DBPaperSize myDBPaperSize = new DBPaperSize();
            //SetPrintForm方法添加自定纸张,参数分别是:打印机名,纸张名,宽,长. 
            myDBPaperSize.SetPrintForm(printDocument1.PrinterSettings.DefaultPageSettings.PrinterSettings.PrinterName,
                "enghui", 240, 140);            //遍历以取出自定义纸张
            string paperName = "enghui";
            foreach (PaperSize paperSize in this.printDocument1.PrinterSettings.PaperSizes)
            {
                if (paperSize.PaperName == paperName)
                {
                    this.printDocument1.DefaultPageSettings.PaperSize = paperSize;
                    break;
                }
            }
            
            //设置页边距
            this.printDocument1.DefaultPageSettings.Margins.Top = this.printDocument1.DefaultPageSettings.Margins.Top / 2;
            this.printDocument1.DefaultPageSettings.Margins.Bottom = this.printDocument1.DefaultPageSettings.Margins.Bottom / 2;       //计算打印行数,kVerticalCellLeeway是行间距,
       linesPerpage = (PageHeight - TopMargin - BottomMargin) / (8 + kVerticalCellLeeway);