Can't find what you're looking for?

Contact us or post in our forums and we'll help you find an answer.

How to hide gridlines in the row/col headers in WinForms

Issue:

SheetView in Spread for WinForms has RowHeader and ColumnHeader properties of type RowHeader and ColumnHeader class, respectively. These classes contain HorizontalGridLine and VerticalGridLine properties which help define the grid lines for the row/column header cells. But these properties alone are not sufficient to hide the grid lines.

Therefore, this article shows how to hide the grid lines for the row/column header cells.

Resolution:

To hide the grid lines for the row and column header cells in Spread, in addition to the HorizontalGridLine and VerticalGridLine properties, following settings are needed:

  • The VisualStyles of the sheet should be turned off.

  • The Renderer of RowHeader’s DefaultStyle should be changed.

  • Since, DefaultStyle work with LegacyBehaviors.Style only. So, the LegacyBehavior should be set to Style.

fpSpread1.Sheets[0].VisualStyles = FarPoint.Win.VisualStyles.Off;
fpSpread1.ActiveSheet.RowHeader.DefaultStyle.Renderer = new FarPoint.Win.Spread.CellType.RowHeaderRenderer();
FarPoint.Win.Spread.GridLine rwGridLine = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.None);
FarPoint.Win.Spread.GridLine colGridLine = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.None);
fpSpread1.Sheets[0].ColumnHeader.HorizontalGridLine = colGridLine;
fpSpread1.Sheets[0].RowHeader.HorizontalGridLine = rwGridLine;
fpSpread1.Sheets[0].ColumnHeader.VerticalGridLine = colGridLine;
fpSpread1.Sheets[0].RowHeader.VerticalGridLine = rwGridLine;

Before:

After: