This project is read-only.

How to change mouseover color of header

Apr 21, 2009 at 2:44 PM
I'm trying to change the mouseover color of a header cell.  I've looked at Sample 28 which uses the default blue color, and several others including Sample 42 which use a white color with an underline.  Unfortunately I can't seem to find anything in the source code which is responsible for this difference. 

Can someone help? 

Thanks.
Apr 21, 2009 at 5:17 PM
Play with these lines from sample 28 

          //ColumnHeader view
            SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader();
            DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader();
            backHeader.BackColor = Color.Maroon;
            backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder;
            viewColumnHeader.Background = backHeader;
            viewColumnHeader.ForeColor = Color.White;
            viewColumnHeader.Font = new Font("Comic Sans MS", 10, FontStyle.Underline);
Nov 24, 2012 at 7:31 AM

public class ImprovedHeader : SourceGrid.Cells.Views.ColumnHeader
{
    protected override void PrepareView(SourceGrid.CellContext context)
    {
        base.PrepareView(context);

        if (context.CellRange.Contains(context.Grid.MouseCellPosition))
        {
            ElementText.ForeColor = HeaderForeColorHot;
        }
        else
        {
            ElementText.ForeColor = HeaderForeColor;
        }
    }
}

HeaderForeColorHot - цвет при наведении мышкой (mouse over color)
HeaderForeColor - обычный цвет (default fore color)