Spread Windows Forms 6.0 Product Documentation
ColumnHeaderRenderer Constructor
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.CellType Namespace > ColumnHeaderRenderer Class : ColumnHeaderRenderer Constructor


Glossary Item Box

Creates a new renderer for the column header.

Overload List

OverloadDescription
ColumnHeaderRenderer Constructor()Creates a new column header renderer.  
ColumnHeaderRenderer Constructor(SerializationInfo,StreamingContext)Creates a new painter of the column header cells from serialization.  

Example

This example creates a custom row filter indicator and a custom sort indicator.
C#Copy Code
private void Form1_Load(object sender, System.EventArgs e)
        {
fpSpread1.ActiveSheet.ColumnHeader.DefaultStyle.Renderer = new myColumnHeaderRenderer();
            fpSpread1.Sheets[0].Columns[0].AllowAutoSort =true;
            fpSpread1.Sheets[0].Columns[0].AllowAutoFilter =true;
        }

public class myColumnHeaderRenderer : FarPoint.Win.Spread.CellType.ColumnHeaderRenderer
    {
        
override public void PaintSortIndicator(Graphics g, Rectangle r, FarPoint.Win.Spread.Appearance appearance, float zoomFactor)
        {
            g.FillRectangle(new SolidBrush(Color.Red), r);
        }

override public void PaintFilterIndicator(Graphics g, Rectangle r, FarPoint.Win.Spread.Appearance appearance, float zoomFactor)
        {
            g.FillRectangle(new SolidBrush(Color.Blue), r);
        }
    }
Visual BasicCopy Code
Public Class myColumnHeaderRenderer
        Inherits FarPoint.Win.Spread.CellType.ColumnHeaderRenderer
        Public Overrides Sub PaintSortIndicator(ByVal g As Graphics, ByVal r As Rectangle, ByVal appearance As FarPoint.Win.Spread.Appearance,
ByVal zoomFactor As Single) 
            g.FillRectangle(New SolidBrush(Color.Red), r)
        End Sub 'PaintSortIndicator

        Public Overrides Sub PaintFilterIndicator(ByVal g As Graphics, ByVal r As Rectangle, ByVal appearance As FarPoint.Win.Spread.Appearance,
ByVal zoomFactor As Single)
            g.FillRectangle(New SolidBrush(Color.Blue), r)
        End Sub 'PaintFilterIndicator
End Class 'myColumnHeaderRenderer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    FpSpread1.ActiveSheet.ColumnHeader.DefaultStyle.Renderer = New myColumnHeaderRenderer
    FpSpread1.Sheets(0).Columns(0).AllowAutoSort = True
    FpSpread1.Sheets(0).Columns(0).AllowAutoFilter = True
End Sub

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.