Spread Windows Forms 17
Spread Windows Forms 17.0 Product Documentation / Developer's Guide / Customizing the Sheet Appearance / Customizing the Renderers
In This Topic
    Customizing the Renderers
    In This Topic

    You can customize the renderers used to create the default styles.

    The Office2013 or Office2016 style uses the FlatCornerHeaderRenderer, FlatColumnHeaderRenderer, FlatRowHeaderRenderer, FlatScrollBarRenderer, and FlatFocusIndicatorRenderer classes.

    Example of default renderer

    The default style uses the ColumnHeaderDefaultEnhanced, CornerDefaultEnhanced, CornerFooterDefaultEnhanced, FilterBarDefaultEnhanced, and RowHeaderDefaultEnhanced fields.

    The Office2007 style uses the EnhancedCornerRenderer, EnhancedFocusIndicatorRenderer, EnhancedColumnHeaderRenderer, EnhancedScrollBarRenderer, and EnhancedRowHeaderRenderer classes.

    Example of customized renderer

    The classic style uses the ColumnHeaderRenderer, RowHeaderRenderer, and CornerRenderer classes.

    Using Code

    1. Create a new renderer and set the renderer properties.
    2. Set the renderer for the default style area such as column footer.
    3. Apply the new corner styles to the control.

    Example

    This example code customizes the renderers for the column header and footer, row header, corner header, and corner footer.

    C#
    Copy Code
    //header/footer column
    fpSpread1.ActiveSheet.ColumnFooter.Visible = true;
    fpSpread1.ActiveSheet.ColumnFooter.RowCount = 3;
    fpSpread1.ActiveSheet.ColumnHeader.RowCount = 3;
    FarPoint.Win.Spread.CellType.FlatColumnHeaderRenderer flatcolumnheader = new FarPoint.Win.Spread.CellType.FlatColumnHeaderRenderer();
    fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle.Renderer = flatcolumnheader;
    FarPoint.Win.Spread.CellType.FlatColumnFooterRenderer flatcolumnfooter = new FarPoint.Win.Spread.CellType.FlatColumnFooterRenderer();
    fpSpread1.ActiveSheet.ColumnFooter.DefaultStyle.Renderer = flatcolumnfooter;
    
    //header row
    fpSpread1.ActiveSheet.RowHeader.ColumnCount = 3;
    FarPoint.Win.Spread.CellType.FlatRowHeaderRenderer flatrowheader = new FarPoint.Win.Spread.CellType.FlatRowHeaderRenderer();
    fpSpread1.ActiveSheet.RowHeader.DefaultStyle.Renderer = flatrowheader;
    
    //sheet corner header render
    FarPoint.Win.Spread.CellType.FlatCornerHeaderRenderer flatconrnerheader = new FarPoint.Win.Spread.CellType.FlatCornerHeaderRenderer();
    fpSpread1.ActiveSheet.SheetCorner.DefaultStyle.Renderer = flatconrnerheader;
    
    //sheet corner footer render
    FarPoint.Win.Spread.SpreadSkin a1 = new FarPoint.Win.Spread.SpreadSkin(FarPoint.Win.Spread.DefaultSpreadSkins.Default);
    a1.Apply(fpSpread1);
    fpSpread1.ActiveSheet.ColumnFooter.Visible = true;
    FarPoint.Win.Spread.CellType.FlatCornerFooterRenderer flatconrnerfooter = new FarPoint.Win.Spread.CellType.FlatCornerFooterRenderer();
    flatconrnerfooter.NormalTriangleColor = Color.Aquamarine;
    FarPoint.Win.Spread.NamedStyle conner = new FarPoint.Win.Spread.NamedStyle("conner", "HeaderDefault");
    conner.BackColor = Color.Olive;
    conner.Renderer = flatconrnerfooter;
    fpSpread1.NamedStyles.Add(conner);
    a1.CornerFooterDefaultStyle = conner;
    
    VB
    Copy Code
    'header/footer column
    fpSpread1.ActiveSheet.ColumnFooter.Visible = True
    fpSpread1.ActiveSheet.ColumnFooter.RowCount = 3
    fpSpread1.ActiveSheet.ColumnHeader.RowCount = 3
    Dim flatcolumnheader As New FarPoint.Win.Spread.CellType.FlatColumnHeaderRenderer()
    fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle.Renderer = flatcolumnheader
    Dim flatcolumnfooter As New FarPoint.Win.Spread.CellType.FlatColumnFooterRenderer()
    fpSpread1.ActiveSheet.ColumnFooter.DefaultStyle.Renderer = flatcolumnfooter
    
    'header row
    fpSpread1.ActiveSheet.RowHeader.ColumnCount = 3
    Dim flatrowheader As New FarPoint.Win.Spread.CellType.FlatRowHeaderRenderer()
    fpSpread1.ActiveSheet.RowHeader.DefaultStyle.Renderer = flatrowheader
    
    'sheet corner header render
    Dim flatconrnerheader As New FarPoint.Win.Spread.CellType.FlatCornerHeaderRenderer()
    fpSpread1.ActiveSheet.SheetCorner.DefaultStyle.Renderer = flatconrnerheader
    
    'sheet corner footer render
    Dim a1 As New FarPoint.Win.Spread.SpreadSkin(FarPoint.Win.Spread.DefaultSpreadSkins.Default)
    a1.Apply(fpSpread1)
    fpSpread1.ActiveSheet.ColumnFooter.Visible = True
    Dim flatconrnerfooter As New FarPoint.Win.Spread.CellType.FlatCornerFooterRenderer()
    flatconrnerfooter.NormalTriangleColor = Color.Aquamarine
    Dim conner = New FarPoint.Win.Spread.NamedStyle("conner", "HeaderDefault")
    conner.BackColor = Color.Olive
    conner.Renderer = flatconrnerfooter
    fpSpread1.NamedStyles.Add(conner)
    a1.CornerFooterDefaultStyle = conner
    
    See Also