这样: 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
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