Does Objective Grid support setting foreground and background colors for individual cells via the PALETTEINDEX or PALETTERGB macro?
Yes, but there was a minor problem with it in the 1.1. Please contact Stingray support for a patch. After you patched your source files, you will be able to support palettes.
You have to override OnDraw and select the palette into the device context and then call the base class version of OnDraw. This is just sample code. You may need to adapt it to your needs.
Example:
CPalette m_palette;
void CMyGridView::OnInitialUpdate(CDC* pDC)
{
// Create a palette
// allocate a log pal and fill it with the color table info
UINT nEntries = ::GetSystemPaletteEntries( pDC->GetSafeHdc(), 0, 1, NULL );
LOGPALETTE* pLogPal = (LOGPALETTE *) malloc(sizeof(LOGPALETTE) + nEntries * sizeof(PALETTEENTRY));
pLogPal->palVersion = 0x300; // Windows 3.0
pLogPal->palNumEntries = nEntries; // table size
for (UINT i=0; i < nEntries; i++) {
pLogPal->palPalEntry[i].peRed = (BYTE) i; // index into system palette
pLogPal->palPalEntry[i].peGreen = 0; // ignored when peFlags = PC_EXPLICIT
pLogPal->palPalEntry[i].peBlue = 0;
pLogPal->palPalEntry[i].peFlags = PC_EXPLICIT;
}
m_palette.CreatePalette(pLogPal);
free (pLogPal);
}
////////////////////////////////////////////////////////////////////
// CMyGridView drawing
void CMyGridView::OnDraw(CDC* pDC)
{
pDC->SelectPalette( &m_palette, FALSE );
pDC->RealizePalette();
// Call base class version of OnDraw
CGXBrowserView::OnDraw(pDC);
}