重载CListCtrl的DrawItem()函数,在里面自己画
看看以前的帖子吧,多如牛毛

解决方案 »

  1.   

    http://www.codeguru.com/listview/LVHighlight.shtml
      

  2.   

    用msdn上的使了不好使,谁能说说原理
      

  3.   

    LISTCTRL中要看你分的多细了,也许里面还要加上TREECTRL关于背景色,确实要自己画一个LISTCTRL 中有一个结构专门有每一个子对象的属性设置,这个你可以参考MSDN中的LISTCTRL类的说明
      

  4.   

    http://codeguru.earthweb.com/listview/col_color.shtmlTo set the background color of a column, the list view control has to be owner drawn. In an owner drawn control, each row is drawn by the application program rather than by the control. So when drawing a row, the background color can be set to our choice within the rectangle occupied by a particular column. To implement an owner drawn control see the topic 'Selection highlighting of entire row'. 
    The code segment below illustrates how to set yellow as the background color for alternate columns. The code shown is part of the DrawItem() function. The first segment draws the background color just before drawing the state icon. The second segment draws the background color within the loop that draws the labels for the remaining columns.  // Set clip region
    rcCol.right = rcCol.left + GetColumnWidth(0);
    CRgn rgn;
    rgn.CreateRectRgnIndirect(&rcCol);
    pDC->SelectClipRgn(&rgn);
    rgn.DeleteObject(); // Draw column background
    if( !bHighlight )
    pDC->FillRect(rcCol, &CBrush(RGB(255,255,0))); // Draw state icon
    if (lvi.state & LVIS_STATEIMAGEMASK) :
    :
    :
    :
       
    for(int nColumn = 1; GetColumn(nColumn, &lvc); nColumn++)
    {
    rcCol.left = rcCol.right;
    rcCol.right += lvc.cx; // Draw column background
    if( !bHighlight || ( bHighlight && m_nHighlight == HIGHLIGHT_NORMAL ) )
    if( (nColumn+1) % 2 )
    pDC->FillRect(rcCol, &CBrush(RGB(255,255,0)));
      

  5.   

    To:: rainwind(我真的很想知道) 
    [email protected]谢谢
      

  6.   

    自己解决了,还是要谢谢大家的热情帮助,在此谢过各位,另请神推手“rovoboy(烟花满天) ”去http://www.csdn.net/expert/topic/403/403703.shtm领分。