我将最下面这个代码写入全局表事件DrawCell中,并在AfterOpenProject中启用全局表事件,没有执行,是什么回事
'对所有外部表启用绘制全局表事件
For Each dt As DataTable In DataTables
dt.GlobalHandler.DrawCell = True
Next
Dim dt As DataTable = CurrentTable.DataTable '获取当前表
Dim tb As Table = CurrentTable '获取当前表
CurrentTable.DataTable.AddUserStyle("灰色",Color.Gray, Color.White)
CurrentTable.DataTable.AddUserStyle("蓝色",Color.Blue, Color.White)
'If CurrentTable.DataTable.Type = 3
Dim jh1 As new List(of String) '当前用户角色
Dim jh2 As new List(of String) '可访问表
Dim jh3 As new List(of String) '当前表允许编辑的列
Dim jh4 As new List(of String) '过程中-当前行可编辑列的拆分为集合
jh1.AddRange(_UserGroup.Split("|")) '将角色添加到集合
If jh1.Contains("管理员")
Return
ElseIf jh1.Count > 0 '角色中不包含管理员
'设置当前用户中所有角色所能编辑当前表的列名
For Each j1 As String In jh1
Dim dr As DataRow = DataTables("用户权限_表权限").Find("角色 = '"& j1 &"' and 可编辑表名 = '"& tb.Name &"'")
If dr IsNot Nothing
jh4.AddRange(dr("可编辑列名").Split(","))
For Each j4 As String In jh4
If jh3.Contains(j4) = False
jh3.Add(j4)
End If
Next
End If
Next
'对当前表所能编辑的列名进行颜色设置
For Each c As Col In tb.Cols
For Each j3 As String In jh3
If c.Name = j3
e.Style = "蓝色"
Else
e.Style = "灰色"
End If
Next
Next
Else
For Each c As Col In tb.Cols
e.Style = "灰色"
Next
End If
'End If