void PaintGridRowsOnlyParent(PaintEventArgs e, Pen gridPen)
{
if (this.TopIndex > -1)
{
int yline = this.CellDataRect.Y - 1;
int rowright = GetGridlineYMax(e);
// Need to draw each row grid at its correct height
for (int irow = this.TopIndex; irow < this.TableModel.Rows.Count; irow++)
{
if (!(this.tableModel.Rows[irow].Parent != null))
{
//if row is not a subrow:drawline and increment yline
if (yline > e.ClipRectangle.Bottom)
break;
if (yline >= this.CellDataRect.Top)
e.Graphics.DrawLine(gridPen, e.ClipRectangle.Left, yline, rowright, yline);
yline += this.TableModel.Rows[irow].Height;
}
else
{
// if row is a subrow,if is visible then increment yline
if (this.tableModel.Rows[irow].Parent.ExpandSubRows)
yline += this.TableModel.Rows[irow].Height;
}
// e.Graphics.DrawLine(gridPen, e.ClipRectangle.Left, yline, e.ClipRectangle.Right, yline);
}
// 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, rowright, yline);
}
}