void PaintGridAllRows(PaintEventArgs e, Pen gridPen)
{
if (this.TopIndex > -1)
{
int yline = this.CellDataRect.Y - 1;
int right = GetGridlineYMax(e);
// Need to draw each row grid at its correct height
for (int irow = this.TopIndex; irow < this.TableModel.Rows.Count; irow++)
{
if (yline > e.ClipRectangle.Bottom)
break;
if (yline >= this.CellDataRect.Top)
e.Graphics.DrawLine(gridPen, e.ClipRectangle.Left, yline, right, yline);
yline += this.TableModel.Rows[irow].Height;
}
// Now draw the final gridline under the last row (if visible)
// TODO Make this option selectable via a parameter?
if (yline < e.ClipRectangle.Bottom)
e.Graphics.DrawLine(gridPen, e.ClipRectangle.Left, yline, right, yline);
}
}