我想实现响应按键使得按键背景变色的功能
以下是我写的代码:HBRUSH CMenuBarDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

// TODO: Change any attributes of the DC here if (pWnd->GetDlgCtrlID()==IDC_MENU_BUTTON1)
{
if (ButtonFlag)    //ButtonFlag是个该类的成员函数,表明按钮正常和按下的状态
{
   pDC->SetBkMode(TRANSPARENT);
HBRUSH hBrush=CreateSolidBrush(RGB(120,0,0));
return hBrush;
} if (!ButtonFlag)
{
   pDC->SetBkMode(TRANSPARENT);
HBRUSH hBrush=CreateSolidBrush(RGB(0,120,0));
return hBrush;
}
}void CMenuBarDlg::OnButton1() 
{
CRect rc;
ButtonFlag=TRUE;    //ButtonFlag的初始状态为FLASE
                GetDlgItem(IDC_MENU_BUTTON1)->GetClientRect(&rc);
InvalidateRect(&rc,FALSE); //???????在这里刷新怎么没调用OnCtlColor改变按钮的颜色呢?
}我的工程中没有鼠标,按键都是响应消息的
OnCtlColor到底是怎么调用的啊?