有什么办法能 让LISTVIEW 判断 某行某列 根据大小来决定 那一行的颜色像这样:列-----------列-----------列--------------列
数据---------数据---------数据------------数据
数据---------数据---------数据------------数据 (判断第四列第二行的数据如果大于1则这一行的颜色为蓝色
数据---------数据---------数据------------数据
数据---------数据---------数据------------数据

解决方案 »

  1.   

    参考
    Public Sub ColorListviewRow(lv As ListView, RowNbr As Long, RowColor As OLE_COLOR)
    '***************************************************************************
    'Purpose: Color a ListView Row
    'Inputs : lv - The ListView
    '         RowNbr - The index of the row to be colored
    '         RowColor - The color to color it
    'Outputs: None
    '***************************************************************************
        
        Dim itmX As ListItem
        Dim lvSI As ListSubItem
        Dim intIndex As Integer
        
        On Error GoTo ErrorRoutine
        
        Set itmX = lv.ListItems(RowNbr)
        itmX.ForeColor = RowColor
        For intIndex = 1 To lv.ColumnHeaders.Count - 1
            Set lvSI = itmX.ListSubItems(intIndex)
            lvSI.ForeColor = RowColor
        Next    Set itmX = Nothing
        Set lvSI = Nothing
        
        Exit SubErrorRoutine:    MsgBox Err.DescriptionEnd Sub
      

  2.   

    改变颜色的条件根据你自己的需求具体写就是了啊.改变颜色是用customdraw方面的,楼主这个你听说过吗?
      

  3.   

    哈哈,这一处我搞复杂啦,以一楼jhone99兄的答案为准:)