7,785
社区成员




Private Sub Form_Load()
Dim i As Long, strLine As String
Dim strField() As String, strNumbers() As String
Dim n As Long
With MSFlexGrid1
.Cols = 3
.Rows = 1
.FixedCols = 0
.FixedRows = 0
.GridLines = flexGridNone
.ColWidth(2) = 340
.ColWidth(0) = (.Width - 700) / 2
.ColWidth(1) = (.Width - 700) / 2
.ColAlignment(0) = 0
.ColAlignment(1) = 0
.ScrollBars = flexScrollBarVertical
Open "d:/test/lotto.txt" For Input As #1
Do Until EOF(1)
Line Input #1, strLine
strField = Split(strLine, Space(1))
If UBound(strField) = 1 Then
strNumbers = Split(strField(1), ",")
If UBound(strNumbers) = 4 Then
n = 0
For i = 0 To 4
n = n + Val(strNumbers(i))
Next i
.AddItem Replace(strLine, Space(1), vbTab) & vbTab & IIf(n > 22, "´ó", "С")
End If
End If
Loop
Close #1
.RemoveItem 0
.Col = 2
For i = 0 To .Rows - 3
myloop:
If i < .Rows - 4 Then
If .TextMatrix(i, 2) = .TextMatrix(i + 1, 2) And .TextMatrix(i, 2) = .TextMatrix(i + 2, 2) And _
.TextMatrix(i, 2) = .TextMatrix(i + 3, 2) And .TextMatrix(i, 2) = .TextMatrix(i + 4, 2) Then
For n = 0 To 4
.Row = i + n
.CellForeColor = vbRed
Next n
i = i + 5
Do Until i >= .Rows Or .TextMatrix(i, 2) <> .TextMatrix(i - 1, 2)
.Row = i
.CellForeColor = vbRed
i = i + 1
Loop
GoTo myloop
End If
End If
If i < .Rows - 3 Then
If .TextMatrix(i, 2) = .TextMatrix(i + 1, 2) And .TextMatrix(i, 2) = .TextMatrix(i + 2, 2) And _
.TextMatrix(i, 2) = .TextMatrix(i + 3, 2) Then
For n = 0 To 3
.Row = i + n
.CellForeColor = vbGreen
Next n
i = i + 4
GoTo myloop
End If
End If
If i < .Rows - 2 Then
If .TextMatrix(i, 2) = .TextMatrix(i + 1, 2) And .TextMatrix(i, 2) = .TextMatrix(i + 2, 2) Then
For n = 0 To 2
.Row = i + n
.CellForeColor = vbYellow
Next n
i = i + 3
GoTo myloop
End If
End If
Next i
End With