XPTable.Models.Table.PaintBrokenGridColumn C# (CSharp) Method

PaintBrokenGridColumn() private method

Draws a vertical grid line that is broken by colspans.
private PaintBrokenGridColumn ( PaintEventArgs e, Pen gridPen, int column, int x ) : void
e PaintEventArgs
gridPen Pen
column int
x int
return void
        void PaintBrokenGridColumn(PaintEventArgs e, Pen gridPen, int column, int x)
        {
            if (x < e.ClipRectangle.Left || x > e.ClipRectangle.Right)
            {
                return;
            }

            int topRow = this.TopIndex;
            int bottom = this.CellDataRect.Bottom;
            int bottomRow = this.RowIndexAt(0, bottom) + 1;

            // Go through each row, and see if it has any colspans that mean we can't draw
            // the vertical gridline as one long line
            int lastRowBottom = 0;
            for (int irow = topRow; irow < bottomRow; irow++)
            {
                Row row = this.TableModel.Rows[irow];
                if (row == null)
                {
                    continue;
                }

                Rectangle rect = this.RowRect(irow);
                var flags = row.InternalGridLineFlags;
                if (flags != null)
                {
                    if (column >= 0 && column < flags.Length && flags[column])
                    {
                        e.Graphics.DrawLine(gridPen, x - 1, rect.Top, x - 1, rect.Bottom - 1);
                    }
                }

                lastRowBottom = rect.Bottom;
            }

            // The column line underneath the data cells
            if (!this.GridLinesContrainedToData && (e.ClipRectangle.Bottom > lastRowBottom))
            {
                e.Graphics.DrawLine(gridPen, x - 1, lastRowBottom, x - 1, e.ClipRectangle.Bottom - 1);
            }
        }
Table