美化 MSHFlexGrid,隔行设置颜色的通用函数

' 设置MSHFlexGrid每行的颜色
Public Sub SetRowColor(ByRef MSHFlexGrid As Object)
    Dim j, i, objName
    objName = TypeName(MSHFlexGrid)
    If StrConv(Trim(objName), vbUpperCase) <> "MSHFLEXGRID" Then
        Exit Sub
    End If
    MSHFlexGrid.FillStyle = 1
    For i = 1 To MSHFlexGrid.Rows - 1
        MSHFlexGrid.Row = i
        If i Mod 2 = 0 Then
            MSHFlexGrid.Col = 0
            MSHFlexGrid.ColSel = MSHFlexGrid.Cols - 1
            MSHFlexGrid.CellBackColor = &H80FFFF
        End If
    Next i
    MSHFlexGrid.FillStyle = 0
    MSHFlexGrid.Row = 0
    MSHFlexGrid.Col = 0
End Sub

你可能感兴趣的:(03,VB,技巧,object)