e.Table.DataTable.AddUserStyle("按编号交替背景色奇",Color.MediumPurple,Color.Black)e.Table.DataTable.AddUserStyle("按编号交替背景色偶",Color.SkyBlue,Color.Black)如果是窗口表,上面代码改改放到afterload事件,不然就放到afteropenproject事件
drawcell
if e.col.name = "第二列" then
Dim vals As List(Of String) = e.Table.DataTable.GetValues("第二列","第二列 Is Not Null")
For i As Integer = 0 To vals.Count - 1
If e.Row("第二列") = vals(i) AndAlso i Mod 2 = 1 Then
e.Style = "按编号交替背景色奇"
ElseIf e.Row("第二列") = vals(i) AndAlso i Mod 2 = 0 Then
e.Style = "按编号交替背景色偶"
End If
Next
end if