void PaintGridColumns(PaintEventArgs e, Pen gridPen)
{
int right = this.DisplayRectangleLeft;
int columns = this.ColumnModel.Columns.Count;
List<bool> wholeLineFlags = this.GetWholeLineFlags(columns);
int bottom = this.GetGridlineXMax(e);
for (int i = 0; i < columns; i++)
{
if (!this.ColumnModel.Columns[i].Visible)
{
continue;
}
right += this.ColumnModel.Columns[i].Width;
// We only draw a single, full-height line if the flags tell us there are no colspans or if it is the
// right hand edge of the last column.
if (wholeLineFlags[i] || i == (columns - 1))
{
if (right >= e.ClipRectangle.Left && right <= e.ClipRectangle.Right)
{
e.Graphics.DrawLine(
gridPen,
right - 1,
e.ClipRectangle.Top,
right - 1,
bottom);
}
}
else
{
// We need to draw the vertical line for each row separately to cope with colspans
this.PaintBrokenGridColumn(e, gridPen, i, right);
}
}
}