想修改button控件文字颜色,自绘了MyButton类 基类CButton,可是按键没有显示,创建按键,添加变量类型为Mybutton,我点击按键创建的位置有响应就是看不到按键,这是为什么?哪位帮帮忙谢谢
void MyButton::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
// TODO: Add your message handler code here and/or call default
CDC *pDC=CDC::FromHandle(lpDrawItemStruct->hDC);
m_ButRect=lpDrawItemStruct->rcItem;
if (m_strText.IsEmpty())GetWindowText(m_strText);
int nSavedDC=pDC->SaveDC();
VERIFY(pDC);
COLORREF bColor,fColor;
switch (m_Style)     
{
case 0:bColor=RGB(192,192,192);fColor=m_ForeColor;  //正常
break;
case 1:bColor=RGB(255,255,255);fColor=m_ForeColor;  //鼠标进入时
break;
case 2:bColor=RGB(192,192,192);fColor=m_ForeColor;   //按下时
break;
case 3:bColor=m_BackColor;fColor=m_LockForeColor;    //锁定时
break;
}
CBrush Brush;
Brush.CreateSolidBrush(m_BackColor);
pDC->SelectObject(&Brush);
CPen Pen;
Pen.CreatePen(PS_SOLID,1,bColor);
pDC->SelectObject(&Pen);
pDC->RoundRect(&m_ButRect,CPoint(5,5));
if (m_Style!=2)
{
CRect Rect;
Rect.SetRect(m_ButRect.left+2,m_ButRect.top+1,m_ButRect.right,m_ButRect.bottom);
pDC->DrawEdge(&Rect,BDR_RAISEDINNER,BF_RECT);
}
pDC->SetTextColor(fColor);
pDC->SetBkMode(TRANSPARENT);
pDC->DrawText(m_strText,&m_ButRect,DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_END_ELLIPSIS);
if (GetFocus()==this)
{
CRect Rect;
Rect.SetRect(m_ButRect.left+3,m_ButRect.top+2,m_ButRect.right-3,m_ButRect.bottom-2);
pDC->DrawFocusRect(&Rect);
}
}