Printing a C# datagridview and so far I have been able to print out the column names but I can't get the information underneath to show up. I'm not using anysource for the data just letting the user input it into a grid like format.
for
(int i = 0; i < dgv.Columns.Count; ++i)
{
string caption = dgv.Columns[i].HeaderText;
w = dgv.Columns[i].Width;
if (xPos + w > x + dgv.Width)
w = x + dgv.Width - xPos;
if (xPos < x + dgv.Width)
mp.DrawString(caption, printFont, _Brush, xPos, yPos, w, h);
if (i == 0) // draw horizontal line below header
mp.DrawLines(_Pen, x, yPos + h, x + dgv.Width, yPos + h);
xPos += w;
for (int j = 0; j < dgv.Rows.Count; ++j)
{
foreach (DataGridViewColumn dc in dgv.Columns)
{
string value = dc.DataPropertyName.ToString();
}
}
}