private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
int height = 0;
int width = 0;
Pen p = new Pen(Brushes.Black, 2.5f);
#region DateCol
e.Graphics.FillRectangle(Brushes.DarkGray,new Rectangle(100,100,dataGridView1.Columns[0].Width,dataGridView1.Rows[0].Height));
e.Graphics.DrawRectangle(p, new Rectangle(100, 100, dataGridView1.Columns[0].Width, dataGridView1.Rows[0].Height));
e.Graphics.DrawString(dataGridView1.Columns[0].HeaderText.ToString(), dataGridView1.Font, Brushes.Black, new Rectangle(100, 100, dataGridView1.Columns[0].Width, dataGridView1.Rows[0].Height));
#endregion
}
height = 100;
//height = dataGridView1.Rows[0].Height;
while (i<dataGridView1.Rows.Count)
{
height += dataGridView1.Rows[0].Height;
e.Graphics.DrawRectangle(p, new Rectangle(100, height, dataGridView1.Columns[0].Width, dataGridView1.Rows[0].Height));
e.Graphics.DrawString(dataGridView1.Rows[i].Cells[0].FormattedValue.ToString(), dataGridView1.Font, Brushes.Black, new Rectangle(100, height, dataGridView1.Columns[0].Width, dataGridView1.Rows[0].Height));
e.Graphics.DrawRectangle(p, new Rectangle(100+dataGridView1.Columns[0].Width, height, dataGridView1.Columns[0].Width, dataGridView1.Rows[0].Height));
e.Graphics.DrawString(dataGridView1.Rows[i].Cells[1].FormattedValue.ToString(), dataGridView1.Font, Brushes.Black, new Rectangle(200, height, dataGridView1.Columns[0].Width, dataGridView1.Rows[0].Height));
i++;
}