当前位置:编程学习 > C#/ASP.NET >>

急,急,急 批量打印问题,求指导

 private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            try
            {
                for (int i = 0; i < (int)nudLabelCount.Value; i++)
                {
                     e.Graphics.DrawImage(BarCodeHelper.MakeBarcodeImage("PD000000" + currentPageIndex, 1, true), 60, 2 + i * 11);                }

            }
            catch (Exception ex) 
            {
                MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK);
            }
        }

为什么不可以批量打印?请指教,在线等 --------------------编程问答-------------------- 你这是批量打印嘛??
我看怎么像循环绘制了? --------------------编程问答-------------------- e.HasMorePages 这个属性可以控件分页。 --------------------编程问答-------------------- private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            try
            { 
               for (int i = 1; i <= (int)nudLabelCount.Value; i++)
                {
                    e.Graphics.DrawImage(BarCodeHelper.MakeBarcodeImage("PD000000" + currentPageIndex, 1, true), 60, 2 + i * 37);

                    currentPageIndex++;
                    if (currentPageIndex < (int)nudLabelCount.Value)
                    {
                        e.HasMorePages = true;
                    }
                    else
                    {
                        e.HasMorePages = false;
                        currentPageIndex = 0;
                    }
                }
        }这样为啥依然不行了,请指教~ --------------------编程问答-------------------- 循环放在外面。
 printDocument1_PrintPage没打印一页,执行一次。
多页这个会调用多次 --------------------编程问答--------------------


int pageCount=(int)nudLabelCount.Value;
int i=1;

private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            try
            { 
              if(i <= (int)nudLabelCount.Value)
                {
                    e.Graphics.DrawImage(BarCodeHelper.MakeBarcodeImage("PD000000" + currentPageIndex, 1, true), 60, 2 + i * 37);

                    currentPageIndex++;
                     i++;
 
                        e.HasMorePages = true;
                   }
                    else
                    {
                        e.HasMorePages = false;
                        currentPageIndex = 0;
                    }
                }
        }






--------------------编程问答-------------------- 楼上这样貌似不行啊 --------------------编程问答--------------------
引用 6 楼 sunboyyun 的回复:
楼上这样貌似不行啊


我也觉得你这是批量绘制啊
整体的一过程叫做打印
循环应该在外边吧 --------------------编程问答-------------------- 两三年前用过有用过通用打印控件,我用过,不过忘记了
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,