The question is like this: define a new class inheritance CHotKeyCtrl
, I want to change the text color in hotkey. Using ON_WM_CTLCOLOR_REFLECT
,but the test color is not changed.the onctlcolor
function cannot run.
MyHotKey.h
class CMyHotKey: public CHotKeyCtrl
{
DECLARE_DYNAMIC(CMyHotKey)
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
};
MyHotKey.cpp
BEGIN_MESSAGE_MAP(CMyHotkey, CHotKeyCtrl)
ON_WM_CTLCOLOR_REFLECT()
ON_WM_ERASEBKGND()
END_MESSAGE_MAP()
HBRUSH CMyHotKey::CtlColor(CDC* pDC, UINT nCtlColor)
{
if(pDC)
{
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkMode(TRANSPARENT);
}
return (HBRUSH)GetStockObject(NULL_BRUSH);
}
Can anyone suggest what I might be doing wrong?