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

C# winform打印分页 入门实例我看不懂啊

int cn = 1; 
        public Form1()
        {
            InitializeComponent();
          
        }

        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            float x = 150.0F;
            float y = 50.0F;
            float z = 25.0F;
            int pageSize = 10;

            Font drawFont = new Font("Arial", 16);
            SolidBrush drawBrush = new SolidBrush(Color.Black);
            StringFormat drawFormat = new StringFormat();
            drawFormat.FormatFlags = StringFormatFlags.DisplayFormatControl;
            for (int i = 1; i <= pageSize; i++)
            {
                e.Graphics.DrawString(cn.ToString()+y.ToString(), drawFont, drawBrush, x, y, drawFormat);
                y = y + z;
                cn++;

                if (cn < 20)
                {
                    e.HasMorePages = true;

                }

转帖请注明来自软工吧论坛http://www.gcs8.cn
                  else
                {
                    e.HasMorePages = false;
                }  
            }        


        }

        private void button1_Click(object sender, EventArgs e)
        {
            PrintPreviewDialog printPreview = new PrintPreviewDialog();
            printPreview.PrintPreviewControl.Document = printDocument1;
            printPreview.ShowDialog();
        }


我是菜鸟 我怎么把代码写进去不行啊  --------------------编程问答-------------------- zzzqaaaaaaaaaaaaa
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,