如何在MSHFLEXGRID中 就像CSDN的  问题显示 那样用颜色隔行表色?不要用FOR一行一行地循环的!那样好慢的。

解决方案 »

  1.   

    这样:
    Dim i As Integer, j As Integer
    With MSHFlexGrid1
        .Redraw = False                  '禁止重画
        .BackColor = vbYellow            '先设置统一底色    For i = 1 To .Rows - 1 Step 2    '仅隔行改色
            .Row = i
            For j = 0 To .Cols - 1
                .CellBackColor = vbBlue
            Next j
        Next i
        .Redraw = True                   '开放重画
        .Refresh
    End With