1.www.codeguru.com/listview,好好看看。
2.CButton也是窗口,取得CDC,然后SetTextColor( COLORREF crColor );

解决方案 »

  1.   

    能具体一点吗?
    我的英语水平有限?能说一下吗?
    怎样取得CButton的CDC呢?
    谢谢?
      

  2.   

    我现在也正在做
    呵呵,不过刚刚做,你命好。
    先从CListCtrl继承个类
    然后将窗口属性加上自画
    重载drawitem
    如下
    还有不明白的
    来信[email protected]
    自画很累,不如下载控件。
    void CMyList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
    {
    int count;
    char str[6];
    m_widthcollumn=0;
    for (count=1;count<=m_columnnumber;count++)
    {
    sprintf(str,"item %d",lpDrawItemStruct->itemID);
    CDC * pDC=CDC::FromHandle(lpDrawItemStruct->hDC);
    pDC->SetBkMode(OPAQUE);
    if (count>1)
    {
    m_rect=lpDrawItemStruct->rcItem;
    m_rect.left=m_widthcollumn;
    m_rect.right=m_rect.left+this->GetColumnWidth(count-1);
    m_widthcollumn=m_rect.right;
    }
    else
    {
    m_rect=lpDrawItemStruct->rcItem;
    m_rect.right=m_rect.left+this->GetColumnWidth(count-1);
    m_widthcollumn=m_rect.right;
    }
    if (count==2)
    {
    pDC->Rectangle(m_rect);
    m_bitmap=::LoadBitmap(::AfxGetApp()->m_hInstance,MAKEINTRESOURCE(IDB_BITMAP1));
    CDC pCompDC;
    pCompDC.CreateCompatibleDC(pDC);
    pCompDC.SelectObject(m_bitmap);
    pDC->BitBlt(m_rect.left+1,m_rect.top+1,12,12,&pCompDC,0,0,SRCCOPY);
    m_rect.left=m_rect.left+16;
    m_rect.bottom--;
    m_rect.top++;
    pDC->DrawText("Check it",5,m_rect,DT_LEFT); }
    else
    {
    pDC->Rectangle(m_rect);
    m_bitmap=::LoadBitmap(::AfxGetApp()->m_hInstance,MAKEINTRESOURCE(IDB_BITMAP2));
    CDC pCompDC;
    pCompDC.CreateCompatibleDC(pDC);
    pCompDC.SelectObject(m_bitmap);
    pDC->BitBlt(m_rect.left+1,m_rect.top+1,12,12,&pCompDC,0,0,SRCCOPY);
    m_rect.left=m_rect.left+16;
    m_rect.bottom--;
    m_rect.top++;
    pDC->DrawText(str,6,m_rect,DT_LEFT);
    }
    }
    }