int GetGridlineXMax(PaintEventArgs e)
{
int bottomRow = RowIndexAt(0, this.CellDataRect.Bottom);
Rectangle rect = RowRect(bottomRow);
int bottom = e.ClipRectangle.Bottom;
if (this.GridLinesContrainedToData && (e.ClipRectangle.Bottom > rect.Bottom))
bottom = rect.Bottom - 1;
return bottom;
}