用下面的代码,可能会好一些,最多也只能优化到这里了。期待高手。
If e.Row.Index >= e.Table.TopVisibleRow AndAlso e.Row.Index <= e.Table.BottomVisibleRow Then
Dim flag As Boolean = False
If e.Row.IsNull(e.Col.Name)= False Then
For j As Integer = 0 To 6
Dim s As New List (Of String)
Dim val As String = e.Row(e.Col.Name)
Dim nr As Row = e.Table.Rows(e.Row.Index + 1)
For i As Integer = 1 To 6
If val = nr(33*j+i) Then
flag = True
Exit For
End If
Next
If e.Col.Index >(33*j) AndAlso e.Col.Index < (33*(j+1)+1) AndAlso flag Then
e.Style = "下期中奖号码"
flag = True
Exit For
Else
flag = False
End If
Next
End If
If flag = False Then
If e.Col.Caption.Contains("未中奖号") Then
e.Style ="未中奖号"
Else If e.Col.Caption.Contains("中奖号") Then
e.Style ="中奖号"
Else If e.Col.Caption= "期号" Then
e.Style ="期号"
End If
End If
End If