实在没多少分了,先给10分吧,高手救命呀!

解决方案 »

  1.   

    http://www.vckbase.com/document/viewdoc/?id=891
      

  2.   

    m_ListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP);
    m_ListCtrl.SetBkColor(RGB(177,151,240));
    m_ListCtrl.SetTextColor(RGB(0,0,0));
    m_ListCtrl.SetTextBkColor(RGB(177,151,240));
      

  3.   

    这个功能比较困难
    因为好像是List的一个缺陷
      

  4.   

    void CRecordList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
    {
    // TODO: Add your message handler code here and/or call default
    CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
    CRect rcItem(lpDrawItemStruct->rcItem);
    int nItem = lpDrawItemStruct->itemID;
    BOOL bFocus = (GetFocus() == this);
    COLORREF clrTextSave, clrBkSave; static _TCHAR szBuff[MAX_PATH];
    LPCTSTR pszText;// get item data LV_ITEM lvi;
    lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
    lvi.iItem = nItem;
    lvi.iSubItem = 0;
    lvi.pszText = szBuff;
    lvi.cchTextMax = sizeof(szBuff);
    lvi.stateMask = 0xFFFF;     // get all state flags
    GetItem(&lvi); BOOL bSelected = (bFocus || (GetStyle() & LVS_SHOWSELALWAYS)) && lvi.state & LVIS_SELECTED;
    bSelected = bSelected || (lvi.state & LVIS_DROPHILITED);// set colors if item is selected
    CRect rcAllLabels;
    GetItemRect(nItem, rcAllLabels, LVIR_BOUNDS);

    rcAllLabels.left = 0;
    if (rcAllLabels.right<m_cxClient)
    rcAllLabels.right = m_cxClient; if (bSelected)
    {
    clrTextSave = pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
    clrBkSave = pDC->SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
    pDC->FillRect(rcAllLabels, &CBrush(::GetSysColor(COLOR_HIGHLIGHT)));
    }
    else
    {
    pDC->FillRect(rcAllLabels, &CBrush(GetItemData(nItem)));
    }    pszText=szBuff; GetItemRect(nItem, rcItem, LVIR_LABEL);

    pszText = MakeShortString(pDC, szBuff,
    rcItem.right-rcItem.left, 0); pDC->DrawText(pszText,-1,rcItem,DT_LEFT | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER); LV_COLUMN lvc;
    lvc.mask = LVCF_FMT | LVCF_WIDTH; for(int nColumn = 1; GetColumn(nColumn, &lvc); nColumn++)
    {
    rcItem.left = rcItem.right;
    rcItem.right += lvc.cx; int nRetLen = GetItemText(nItem, nColumn,szBuff, sizeof(szBuff));
    if (nRetLen == 0)
    continue; pszText = MakeShortString(pDC, szBuff,
    rcItem.right - rcItem.left, 0); UINT nJustify = DT_LEFT; if(pszText == szBuff)
    {
    switch(lvc.fmt & LVCFMT_JUSTIFYMASK)
    {
    case LVCFMT_RIGHT:
    nJustify = DT_RIGHT;
    break;
    case LVCFMT_CENTER:
    nJustify = DT_CENTER;
    break;
    default:
    break;
    }
    }
    pDC->DrawText(pszText, -1, rcItem,
    nJustify | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER);
    }// draw focus rectangle if item has focus if (lvi.state & LVIS_FOCUSED && bFocus)
    pDC->DrawFocusRect(rcAllLabels); // set original colors if item was selected if (bSelected)
    {
    pDC->SetTextColor(clrTextSave);
    pDC->SetBkColor(clrBkSave);
    }
    // AfxMessageBox("draw item");
    }m_MyList.SetItemData(i,(DWORD)RGB(255,0,0));
      

  5.   

    使用XListCtrl类,在vckbase上可以找到。