Sunday, 23 June 2013

How to print multiple pages from data grid with header and footer

i used this code to print datagridview but it is working for single page only.  i need to print multiple pages

 private void print_Click(object sender, EventArgs e)
       {
           PrintDialog printDialog1 = new PrintDialog();
           printDialog1.Document = printDocument1;
           DialogResult result = printDialog1.ShowDialog();

           if (result == DialogResult.OK)
           {
               printDocument1.Print();
           }

       }
private void printDocument1_PrintPage_1(object sender, System.Drawing.Printing.PrintPageEventArgs e)
       {
           Bitmap bm = new Bitmap(this.dataGridView1.Width, this.dataGridView1.Height);
           this.dataGridView1.DrawToBitmap(bm, new Rectangle(0, 0, this.dataGridView1.Width, this.dataGridView1.Height));
           e.Graphics.DrawImage(bm, 0, 0);
       }

2) And one more is how to add Header and Footer to datagridview

3) How to apply Style Sheet to forms in windows application?

I want all these things in windows c# application

 

No comments:

Post a Comment

Receive All Free Updates Via Facebook.