最后在DrawCell事件中设置如下代码:
'如果是数值型列,且不是总分列
If e.Col.IsNumeric AndAlso e.Col.Name <> "总分" Then
If e.Row.IsNull(e.Col.Name) = False '且该列已经输入内容
If e.Row(e.Col.Name) < 60 Then '如果该列的值小于60
e.Style = "不及格" '那么用"不及格"样式绘制单元格
ElseIf e.Row(e.Col.Name) > 95 Then '如果单元格的值大于95
e.Style = "优秀" '那么用"优秀"样式绘制单元格
End If
End If
End If
现在程序将用不同的背景颜色,分别标出优秀和不及格的分数:

如何实现将每行相同数字标识,按行进行对比,以行行对比?比图中第4行和第6行都有一个96,第5行和第8行,第1行有2个72
If e.Col.IsNumeric AndAlso e.Col.Name <> "总分" Thendim a as boolaen
for each c as col in e.table.cols
If c.IsNumeric AndAlso c.Name <> "总分" andalso e.Col.Name <> c.name Then
if e.row(e.col.name) = e.row(c.name) orelse e.table.compute("count(" & c.name & ")",c.name & "=" & e.row(e.col.name)) > 0 then
e.Style = "样式1"
a=true
exit for
end if
end if
next
if a=false then
if e.table.compute("count(" & e.col.name & ")",e.col.name & "=" & e.row(e.col.name)) > 1 then
e.Style = "样式1"
end if
endif
End If
SQLTable的样式
下面代码执行无效
'样式
'DataTables("窗口_Table2").AddUserStyle("产品编号", Color.Red, Color.Red)
需求:窗口_Table2,产品编号、品名列的标题蓝色,其内容或数据为绿 ,如何实现?
这个代码只是添加了样式,要在drawcell事件里使用这个样式
'Tables("窗口_Table1").SetHeaderCellBackColor("期初_单价", Color.DeepSkyBlue , 0)
'Tables("窗口_Table1").SetHeaderCellBackColor("期初_单价", Color.DeepSkyBlue , 1)
'Tables("窗口_Table1").SetHeaderCellBackColor("期初_数量", Color.DeepSkyBlue , 1)
'Tables("窗口_Table1").SetHeaderCellBackColor("期初_数量", Color.DeepSkyBlue , 2)
'Tables("窗口_Table1").SetHeaderCellBackColor("期初_金额", Color.DeepSkyBlue , 1)
'Tables("窗口_Table1").SetHeaderCellBackColor("期初_金额", Color.DeepSkyBlue , 3)
'Tables("窗口_Table1").SetHeaderCellBackColor("库存_单价", Color.Aqua , 0)
'Tables("窗口_Table1").SetHeaderCellBackColor("库存_单价", Color.Aqua , 1)
'Tables("窗口_Table1").SetHeaderCellBackColor("库存_数量", Color.Aqua , 1)
'Tables("窗口_Table1").SetHeaderCellBackColor("库存_数量", Color.Aqua , 2)
'Tables("窗口_Table1").SetHeaderCellBackColor("库存_金额", Color.Aqua , 1)
'Tables("窗口_Table1").SetHeaderCellBackColor("库存_金额", Color.Aqua , 3)
执行上面代码,单击目录树,报错:
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.8.18.1
错误所在事件:表,窗口_Table1,DrawCell
详细错误信息:
调用的目标发生了异常。
CellRange is invalid.
注销上面代码,单击目录树,正常,上面是哪些错,如何纠正?
总共有几层表头?代码最大用到了3,有4层表头那么多?