错误提示:
.NET Framework 版本:4.0.30319.1022
Foxtable 版本:2019.6.18.1
错误所在事件:配色表,AfterSelRangeChange
详细错误信息:
索引超出范围。必须为非负值并小于集合大小。
参数名: index
操作代码是这样的:
If usna Like "*设计*" Or usna="admin" Then
If Tables("配色表").Current("审核") = False Then
If Tables("配色表").TopPosition>-1 Then
'For i As Integer=Tables("配色表").BottomPosition To Tables("配色表").TopPosition Step -1
For Each p As Integer In pscm1
Tables("配色表").Rows(p).Delete()
Next
End If
End If
End If
AfterSelRangeChange代码是这样的:
If Tables("配色表").RowSel < 0 OrElse Tables("配色表").ColSel < 0 Then
e.cancel=True
End If
If vars("stop") = True Then Return
If ModifierKey <> Keys.Control Then
For Each p As Integer In pscm1
If p >= 0 Then
For i As Integer = 1 To e.Table.Cols.count
e.Table.Grid.SetCellStyle(p+1, i, "")
Next
End If
Next
pscm1.clear
End If
For i As Integer = e.NewRange.TopRow To e.NewRange.BottomRow
Dim p As Integer = i
If i >= 0 AndAlso pscm1.contains(p) = False Then
pscm1.add(p)
End If
Next
For Each p As Integer In pscm1
If p >= 0 Then
Dim s As C1.Win.C1FlexGrid.CellStyle = e.Table.grid.Styles.Add("selected")
s.backcolor = Color.red '背景
For i As Integer = 1 To e.Table.Cols.count
e.Table.Grid.SetCellStyle(p+1, i, s)
Next
e.Table.DataTable.SysStyles("Focus").BackColor = Color.red
End If
Next