谢谢。

解决方案 »

  1.   

    CListCtrl m_listctrl;
    用 m_listctrl.SetBkColor(RGB(200,180,240));
    m_listctrl.SetTextColor(RGB(0,0,0));
    m_listctrl.SetTextBkColor(RGB(177,151,240));
      

  2.   

    我指的是每个Cell,不是整体的背景.
      

  3.   

    这个要OWNDRAW,去codeguru吧。上面有很多例子
      

  4.   

    好像可以在插入每一行的时候,设置那个LVITEM structure
      

  5.   

    看看这里吧,http://www.codeproject.com/listctrl/xlistctrl.asp,用xlistctrl,绝对能够满足你的要求!
      

  6.   

    这是我刚知道的,呵呵,共享:
    头文件中定义消息(在关键字“//}}AFX_MSG”之外):
    afx_msg void OnCustomdrawList(NMHDR*, LRESULT*);
    实现文件中响应消息(在关键字“//}}AFX_MSG”之外):
    ON_NOTIFY(NM_CUSTOMDRAW, IDC_STRENGTHENMAP, OnCustomdrawList)
    实现文件中函数:
    void CYourClass::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
    {
    NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR); // Take the default processing unless we set this to something else below.
    *pResult = 0;    if(CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
    *pResult = CDRF_NOTIFYITEMDRAW;
        else if(CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
    *pResult = CDRF_NOTIFYSUBITEMDRAW;
        else if((CDDS_ITEMPREPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage)
    {
                      COLORREF crBkgnd;
                      int iCurRow = static_cast<int>( pLVCD->nmcd.dwItemSpec );
                      int iCurColumn = pLVCD->iSubItem;
    if(iCurRow == 需要定义背景颜色的行号 && iCurColumn == 列号)
    {//这里是控制修改背景色的单元格所在的位置;
    crBkgnd = RGB(0, 0, 255);//背景色设为蓝色;
    break;
    }
    else
    crBkgnd = RGB(255, 255, 255);//其他设为白色; pLVCD->clrTextBk = crBkgnd;        *pResult = CDRF_DODEFAULT;
    }
    }