Hello,
I have successfully created a function to change the text colour of a grid cell.
However, this interferes with the drawing of the CExtContentExpandWnd and makes the text the wrong colour.
The way I am attempting to get round this is to override the OnPaintExpandedContent function and implement
my own drawing for the CExtContentExpandWnd. This is working well apart from the drawing of the shadow.
It is only drawing a one pixel high line at the bottom of the main rectangle.
Please refer to the code below and explain where I am going wrong.
virtual bool OnPaintExpandedContent(
CExtContentExpandWnd::PAINT_ITEM_CONTENT_DATA & picd,
const CExtGridWnd & wndGrid,
const CExtGridHitTestInfo & htInfo,
CExtContentExpandWnd & wndContentExpand,
INT nSizeOfExpandShadow
) const
{
// create font
CFont m_Font;
LOGFONT* m_pLF;
m_pLF=(LOGFONT*)calloc(1,sizeof(LOGFONT));
strncpy(m_pLF->lfFaceName,"Tahoma",31);
m_pLF->lfHeight=13;
m_pLF->lfWeight=500;
m_pLF->lfItalic=0;
m_pLF->lfUnderline=0;
m_Font.CreateFontIndirect(m_pLF);
// draw CExtContentExpandWnd
picd.m_dc.FillSolidRect(picd.m_rcItem.left, picd.m_rcItem.top, picd.m_rcItem.Width()-nSizeOfExpandShadow, picd.m_rcItem.Height()-nSizeOfExpandShadow, RGB(0,0,0));
picd.m_dc.FillSolidRect(picd.m_rcItem.left+1, picd.m_rcItem.top+1, picd.m_rcItem.Width()-2-nSizeOfExpandShadow, picd.m_rcItem.Height()-2-nSizeOfExpandShadow, RGB(255,255,225));
picd.m_dc.SelectObject(m_Font);
picd.m_dc.SetTextColor(RGB(0,0,0));
picd.m_dc.TextOut(2, 2, m_strData);
free(m_pLF);
// draw shadow
CRect rc1stArea, rc2ndArea;
rc1stArea = CRect::CRect(0,0,0,0);
rc2ndArea = CRect::CRect(0,0,0,0);
CExtWndShadow wndShadow;
//wndShadow.Restore(picd.m_dc);
wndShadow.Paint(
picd.m_dc,
picd.m_rcItem,
&rc1stArea,
&rc2ndArea,
nSizeOfExpandShadow
);
return true;
}
Regards,
David.