Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PrintDoc2_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.PageUnit = System.Drawing.GraphicsUnit.Millimeter; //单位为毫米
            for (int i = 0; i < 12; i++)
            {
                curr = total * i + currPage;
                //Form1.log.InfoFormat("当前:{0} 总的个数:{1}", curr, detaillist.Count);
                if (curr >= detaillist.Count)
                {
                    continue;
                }

                if (i < 6)
                {
                    Tag_Draw(LeftMargin + i * 45, topMargin + 95, e.Graphics, detaillist[curr]);
                }
                else
                {
                    Tag_Draw(LeftMargin + (i - 6) * 45, topMargin + 298 + 6, e.Graphics, detaillist[curr]);
                }
                pagelabel.label(i, detaillist[curr].Sphh + '_' + detaillist[curr].Hx);
            }
            //写页信息
            e.Graphics.DrawString(String.Format("共{0}页 第 {1} 页", total, currPage + 1), font, brush, new Point(5, 435));

            currPage++;
            if (currPage < total)
            {
                e.HasMorePages = true;
            }
            else
            {
                e.HasMorePages = false;
            }
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PrintDoc2_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.PageUnit = System.Drawing.GraphicsUnit.Millimeter; //单位为毫米

            /*
             * Form1.log.InfoFormat("上边距为:{0}", topMargin);
             *
             * e.Graphics.FillRectangle(brush, new Rectangle(LeftMargin - 5, topMargin - 5, 6 * 45 + 10, 95 + 5));//上部分矩形填充
             * e.Graphics.FillRectangle(brush, new Rectangle(LeftMargin - 5, topMargin + 95 + 108 + 3, 6 * 45 + 10, 95 + 3));//下部分矩形填充
             * e.Graphics.DrawLine(penBlack, new Point(LeftMargin - 10, topMargin), new Point(6 * 45 + 40, topMargin));
             * //
             * e.Graphics.DrawLine(penBlack, new Point(LeftMargin - 10, topMargin + 95 + 108), new Point(LeftMargin, topMargin + 95 + 108));
             * e.Graphics.DrawLine(penBlack, new Point(LeftMargin + 6 * 45, topMargin + 95 + 108),
             *  new Point(LeftMargin + 6 * 45 + 10, topMargin + 95 + 108));
             * //
             * e.Graphics.DrawLine(penBlack, new Point(LeftMargin - 10, topMargin + 95 + 108 + 6), new Point(6 * 45 + 40, topMargin + 95 + 108 + 6));
             * e.Graphics.DrawLine(penBlack, new Point(LeftMargin - 10, topMargin + 2 * 95 + 2 * 108 + 6),
             *  new Point(LeftMargin, topMargin + 2 * 95 + 2 * 108 + 6));
             * e.Graphics.DrawLine(penBlack, new Point(LeftMargin + 6 * 45, topMargin + 2 * 95 + 2 * 108 + 6),
             *  new Point(LeftMargin + 6 * 45 + 10, topMargin + 2 * 95 + 2 * 108 + 6));
             * for (int i = 0; i < 7; i++)
             * {
             *  e.Graphics.DrawLine(penBlack, new Point(LeftMargin + 45 * i, topMargin - 10), new Point(LeftMargin + 45 * i, 50));
             *  e.Graphics.DrawLine(penBlack, new Point(LeftMargin + 45 * i, topMargin + 2 * 95 + 2 * 108 + 6), new Point(LeftMargin + 45 * i, 440));
             * }
             */
            for (int i = 0; i < 12; i++)
            {
                curr = total * i + currPage;
                if (curr >= detaillist.Count)
                {
                    continue;
                }

                if (i < 6)
                {
                    Tag_Draw(LeftMargin + i * 45, topMargin + 95, e.Graphics, detaillist[curr]);
                }
                else
                {
                    Tag_Draw(LeftMargin + (i - 6) * 45, topMargin + 298 + 6, e.Graphics, detaillist[curr]);
                }
                pagelabel.label(i, detaillist[curr].Sphh + '_' + detaillist[curr].Hx);
            }
            //写页信息
            Font font7 = new Font("微软雅黑", 7, FontStyle.Regular);

            e.Graphics.DrawString(String.Format("共{0}页 第 {1} 页 订单号: {2}", total, currPage + 1, Order.Ordersn), font7, brush, new Point(5, 435));
            currPage++;

            if (currPage < total)
            {
                e.HasMorePages = true;
            }
            else
            {
                e.HasMorePages = false;
            }
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PrintDoc2_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.PageUnit = System.Drawing.GraphicsUnit.Millimeter; //单位为毫米

            for (int i = 0; i < PageLableCount; i++)
            {
                curr = total * i + currPage;
                if (curr >= detaillist.Count)
                {
                    continue;
                }

                if (i < PageLabelRowCount)
                {
                    Tag_Draw(LeftMargin + i * LabelWidth, topMargin + LabelTotalHeigth - LabelHeigth, e.Graphics, detaillist[curr]);
                }
                else
                {
                    Tag_Draw(LeftMargin + (i - PageLabelRowCount) * LabelWidth, topMargin + LabelTotalHeigth * 2 - LabelHeigth + 6, e.Graphics, detaillist[curr]);
                }
                pagelabel.label(i, detaillist[curr].Sphh + '_' + detaillist[curr].Hx);
            }
            //写页信息
            Font font7 = new Font("微软雅黑", 7, FontStyle.Regular);

            e.Graphics.DrawString(String.Format("共{0}页 第 {1} 页 订单号: {2} 模板: {3}", total, currPage + 1, Order.Ordersn,
                                                CurrentTemp), font7, brush, new Point(250, 3));
            e.Graphics.DrawString(String.Format("共{0}页 第 {1} 页 订单号: {2} 模板: {3}", total, currPage + 1, Order.Ordersn,
                                                CurrentTemp), font7, brush, new Point(5, 435));
            currPage++;

            if (currPage < total)
            {
                e.HasMorePages = true;
            }
            else
            {
                e.HasMorePages = false;
            }
        }