I want to print some data that appear in Form.
I print some data( image, labels....) then at point y = 415, I will print all rows of datagridview, at here all is right, but when i want to print rows that need more page, i had wrong result, this is my trying:
int y = 415;
for (int i = 0; i < DataGridView1.Rows.Count; i++){e.Graphics.DrawLine( Pen, new Point(818, y), new Point(818, y + 35));e.Graphics.DrawString(DataGridView1.Rows[i].Cells[0].Value.ToString(), new Font("Arial", 16, FontStyle.Bold), Brushes.Black, new Point(770, y + 7), format1);y += 35;if (y > e.PageBounds.Height - 25){y = 50;e.HasMorePages = true;return;}else{ e.HasMorePages = false; }}
Now, if result need more than one page, i get one page duplicated infinite of times, or i get all results in one page(above of each) if i remove syntax "return;" in if(condittion).
thank you
thank you
Krishna Rajput SinghPosted Mar 31, 2016, 8:32 AM
Krishna Rajput SinghPosted Apr 1, 2016, 5:42 AM