Для того, чтобы можно было красить CStatic нужно завести класс производный от CStatic:
class CStaticColor : public CStatic
{
.....
};
Отловить событие смены цвета.
BEGIN_MESSAGE_MAP(CStaticColor, CStatic)
//{{AFX_MSG_MAP(CStaticColor)
ON_WM_CTLCOLOR_REFLECT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
И его обработать.
HBRUSH CStaticColor::CtlColor(CDC* pDC, UINT nCtlColor)
{
// TODO: Change any attributes of the DC here
pDC->SetTextColor(m_crTextColor);
pDC->SetBkColor(m_crBkColor);
return (HBRUSH)m_brBkgnd;
// TODO: Return a non-NULL brush if the parent's handler should not be called
//return NULL;
}
void CStaticColor::SetTextColor(COLORREF crTextColor)
{
// Set new foreground color
if (crTextColor != 0xffffffff)
{
m_crTextColor = crTextColor;
}
else // Set default foreground color
{
m_crTextColor = ::GetSysColor(COLOR_BTNTEXT);
}
// Repaint control
Invalidate();
} // End of SetTextColor
