Spread Windows Forms 12.0 Product Documentation
Customizing the Style of Header Cells
Spread Windows Forms 12.0 Product Documentation > Developer's Guide > Customizing Row, Column, and Cell Appearance > Customizing the Appearance of Headers > Customizing the Style of Header Cells

You can customize the style of header cells if you want to change the default appearance. You can set or customize many features, including:

To customize style properties for the header classes, set the default style of the header cells by setting the RowHeader DefaultStyle property or the ColumnHeader DefaultStyle property. For more information on what can be set, refer to the StyleInfo object and the RowHeader and ColumnHeader objects.

Before

Header Style Before (no change)

After

Header Style Example (After)

To customize using the renderers, set their members to customize the appearance of headers. The renderers used in the Office2013 or Office 2016 style are shown and listed in the following figure.

Header renderers

You can also use default classes to customize many of the header appearance properties by setting the properties of the Columns.DefaultColumn class and the Rows.DefaultRow class.

You can also set the grid lines around the header cells to change the three-dimensional appearance. Refer to Customizing the Header Grid Lines.

You can also add gradients to the header cells. Refer to Adding a Gradient to Header Cells.

Using a Shortcut

  1. To change the style for the column header, define a style and then set the ColumnHeader object DefaultStyle property.
  2. To change the settings for the row header, define a style and then set the RowHeader object DefaultStyle property.

Example

This example code defines a style with new colors and applies it to the column header as shown in the figure in this topic.

C#
Copy Code
fpSpread1.VisualStyles = FarPoint.Win.VisualStyles.Off;
// Define a new style.
FarPoint.Win.Spread.StyleInfo darkstyle = new FarPoint.Win.Spread.StyleInfo();
darkstyle.BackColor = Color.Teal;
darkstyle.ForeColor = Color.Yellow;
// Apply the new style to the column header of a sheet.
fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = darkstyle;
VB
Copy Code
fpSpread1.VisualStyles = FarPoint.Win.VisualStyles.Off
' Define a new style.
Dim darkstyle As New FarPoint.Win.Spread.StyleInfo()
darkstyle.BackColor = Color.Teal
darkstyle.ForeColor = Color.Yellow
' Apply the new style to the column header of a sheet.
fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle = darkstyle