Is there a virtual that I can override to change the appearance of the current cell?
You should override GetStyleRowCol( ) and set the interior-attribute for the cell depending on the current cell position.
Furthermore you should set m_bRefreshOnSetCurrentCell = TRUE so that the current cell gets redrawn when you use the arrow keys to navigate in the grid.
Example:
BOOL CBrowserView::GetStyleRowCol(ROWCOL nRow, ROWCOL nCol, CGXStyle& style, GXModifyType mt, int nType)
{
if (!base_class::GetStyleRowCol(nRow, nCol, style, mt, nType))
return FALSE;
// You may also initialize the following attribute
// in your OnInitialUpdate method.
m_bRefreshOnSetCurrentCell = TRUE; // allways redraw current cell when moved
// Check if this is the current cell
if (!IsPrinting() && nRow > 0 && nCol > 0)
{
// NOTE: This is only an example. You may customize the
// behavior to your specific needs. Using the grids default
// outlining of the current cell will probably look better
// than this sample (has a nicer border).
if (IsCurrentCell(nRow, nCol))
{
// draw background of cell red
style.SetInterior(RGB(255,0,0));
// draw border in highlight around current cell
style.SetBorders(gxBorderAll,
CGXPen().SetWidth(1).SetColor(COLOR_HIGHLIGHT));
// NOTE: If you want to do this, you should disable
// the default outlining of the current cell by placing
// the following lines in your OnInitialUpdate routine:
//
// CGXProperties* pProp = GetParam()->GetProperties();
// pProp->SetUserProperty(GX_IDS_OUTLINECURRENTCELL,
// (CGXStyle) pProp->sInvertNoBorder);
}
}
return TRUE;
}