// Draw borders and grid lines after the last row on a page is drawn // or the last row of the table is drawn. private void DrawBorders() { // draw top border line Contents.DrawLine(BorderLeftPos, BorderYPos[0], BorderRightPos, BorderYPos[0], Borders.TopBorder); // row int RowStart = 1; int RowEnd = BorderYPos.Count - 1; // draw horizontal header border line if (BorderHeaderActive) { Contents.DrawLine(BorderLeftPos, BorderYPos[1], BorderRightPos, BorderYPos[1], Borders.HeaderHorBorder); RowStart++; } // draw horizontal cells border lines for (int Row = RowStart; Row < RowEnd; Row++) { Contents.DrawLine(BorderLeftPos, BorderYPos[Row], BorderRightPos, BorderYPos[Row], Borders.CellHorBorder); } // draw horizontal bottom border line Contents.DrawLine(BorderLeftPos, BorderRowTopPos, BorderRightPos, BorderRowTopPos, Borders.BottomBorder); // draw each vertical border line for header style if (BorderHeaderActive && Borders.HeaderVertBorderActive) { for (int Col = 0; Col <= Columns; Col++) { Contents.DrawLine(ColumnPosition[Col], BorderYPos[0], ColumnPosition[Col], BorderYPos[1], Borders.HeaderVertBorder[Col]); } } // draw each vertical line between cells if (Borders.CellVertBorderActive) { double Top = BorderHeaderActive ? BorderYPos[1] : BorderYPos[0]; for (int Col = 0; Col <= Columns; Col++) { Contents.DrawLine(ColumnPosition[Col], Top, ColumnPosition[Col], BorderRowTopPos, Borders.CellVertBorder[Col]); } } return; }