CCheckListBox 怎么改变checkbox里字体的颜色呢?

CCheckListBox 如何改变checkbox里字体的颜色呢??????
如题

------解决方案--------------------
这个得自绘,我觉得用CListBox就可以了,至于那个checkbox,你可以自己话
------解决方案--------------------
这个比较麻烦, 你得做一个类继承 CCheckListBox, 在checkbox放一个rect,再去改变rect文字颜色
------解决方案--------------------
C/C++ code
DrawCheckbox(int nItem,
                              int nSubItem,
                              CDC *pDC,
                              COLORREF crText,
                              COLORREF crBkgnd,
                              CRect& rect,
                              XLISTCTRLDATA *pXLCD)
{
    ASSERT(pDC);
    ASSERT(pXLCD);

    if (rect.IsRectEmpty())
    {
        return;
    }

    GetDrawColors(nItem, nSubItem, crText, crBkgnd);

    pDC->FillSolidRect(&rect, crBkgnd);

    CRect chkboxrect;
    chkboxrect = rect;
    chkboxrect.bottom -= 1;
    chkboxrect.left += 9;        // line up checkbox with header checkbox
    chkboxrect.right = chkboxrect.left + chkboxrect.Height();    // width = height

    CString str;
    str = GetItemText(nItem, nSubItem);

    if (str.IsEmpty())
    {
        // center the checkbox

        chkboxrect.left = rect.left + rect.Width()/2 - chkboxrect.Height()/2 - 1;
        chkboxrect.right = chkboxrect.left + chkboxrect.Height();
    }

    // fill rect around checkbox with white
    pDC->FillSolidRect(&chkboxrect, m_crWindow);

    // draw border
    CBrush brush(RGB(51,102,153));
    pDC->FrameRect(&chkboxrect, &brush);

    if (pXLCD[nSubItem].nCheckedState == 1)
    {
        CPen *pOldPen = NULL;

        CPen graypen(PS_SOLID, 1, m_crGrayText);
        CPen blackpen(PS_SOLID, 1, RGB(51,153,51));

        if (pXLCD[0].bEnabled)
            pOldPen = pDC->SelectObject(&blackpen);
        else
            pOldPen = pDC->SelectObject(&graypen);

        // draw the checkmark
        int x = chkboxrect.left + 9;
        ASSERT(x < chkboxrect.right);
        int y = chkboxrect.top + 3;
        int i;
        for (i = 0; i < 4; i++)
        {
            pDC->MoveTo(x, y);
            pDC->LineTo(x, y+3);
            x--;
            y++;
        }
        for (i = 0; i < 3; i++)
        {
            pDC->MoveTo(x, y);
            pDC->LineTo(x, y+3);
            x--;
            y--;
        }

        if (pOldPen)
            pDC->SelectObject(pOldPen);
    }

    if (!str.IsEmpty())
    {
        pDC->SetBkMode(TRANSPARENT);
        pDC->SetTextColor(crText);
        pDC->SetBkColor(crBkgnd);
        CRect textrect;
        textrect = rect;
        textrect.left = chkboxrect.right + 4;

        UINT nFormat = DT_LEFT | DT_VCENTER | DT_SINGLELINE;    //+++
        if (m_bUseEllipsis)
            nFormat |= DT_END_ELLIPSIS;

        pDC->DrawText(str, &textrect, nFormat);
    }
}

------解决方案--------------------
重载WM_DRAWITEM消息
颜色自己改改
C/C++ code

void CDlg1Dlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
  // TODO: Add your message handler code here and/or call default
  if(nIDCtl == m_CheckListBox.GetDlgCtrlID())    
  {
    CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
    
    if (((LONG)(lpDrawItemStruct->itemID) >= 0) &&
      (lpDrawItemStruct->itemAction & (ODA_DRAWENTIRE | ODA_SELECT)))
    {
      int cyItem = m_CheckListBox.GetItemHeight(lpDrawItemStruct->itemID);
      BOOL fDisabled = !IsWindowEnabled() || !m_CheckListBox.IsEnabled(lpDrawItemStruct->itemID);
      
      COLORREF newTextColor = fDisabled ?
        RGB(0x80, 0x80, 0x80) : GetSysColor(COLOR_WINDOWTEXT);  // light gray          
      COLORREF oldTextColor = pDC->SetTextColor(newTextColor);
      
      COLORREF newBkColor = GetSysColor(COLOR_WINDOW);
      COLORREF oldBkColor = pDC->SetBkColor(newBkColor);
      
      if (newTextColor == newBkColor)
        newTextColor = RGB(0xC0, 0xC0, 0xC0);   // dark gray
      
      if (!fDisabled && ((lpDrawItemStruct->itemState & ODS_SELECTED) != 0))
      {
        pDC->SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT));
        pDC->SetBkColor(GetSysColor(COLOR_HIGHLIGHT));
      }
      
      int m_cyText = 20;
      TEXTMETRIC txtMetric;
      GetTextMetrics(pDC->GetSafeHdc(), &txtMetric);
      m_cyText = txtMetric.tmHeight;
      //if (m_cyText == 0)
      //  VERIFY(cyItem >= CalcMinimumItemHeight());
      
      CString strText;
      m_CheckListBox.GetText(lpDrawItemStruct->itemID, strText);
      
      pDC->ExtTextOut(lpDrawItemStruct->rcItem.left,
        lpDrawItemStruct->rcItem.top + max(0, (cyItem - m_cyText) / 2),
        ETO_OPAQUE, &(lpDrawItemStruct->rcItem), strText, strText.GetLength(), NULL);
      
      pDC->SetTextColor(oldTextColor);
      pDC->SetBkColor(oldBkColor);
    }
    
    if ((lpDrawItemStruct->itemAction & ODA_FOCUS) != 0)
      pDC->DrawFocusRect(&(lpDrawItemStruct->rcItem));
    
    return;
  }
  
  CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);
}