Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共9 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:样式问题

1楼
lin98 发表于:2023/11/20 9:45:00

最后在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

2楼
有点蓝 发表于:2023/11/20 10:08:00
If e.Col.IsNumeric AndAlso e.Col.Name <> "总分" Then
dim 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
3楼
lin98 发表于:2023/11/20 10:15:00
SQLTable的样式
下面代码执行无效
'样式
'DataTables("窗口_Table2").AddUserStyle("产品编号", Color.Red, Color.Red)

需求:窗口_Table2,产品编号、品名列的标题蓝色,其内容或数据为绿 ,如何实现?
4楼
有点蓝 发表于:2023/11/20 10:27:00
AddUserStyle(Name,BackColor,ForeColor)

Name:      样式名称
BackColor: 背景颜色
ForeColor: 字体颜色
5楼
lin98 发表于:2023/11/20 10:34:00
用红色,执行下面代码,都没任何反应?
DataTables("窗口_Table2").AddUserStyle("产品编号", Color.Red, Color.Red)
6楼
有点蓝 发表于:2023/11/20 10:43:00
这个代码只是添加了样式,要在drawcell事件里使用这个样式
7楼
lin98 发表于:2023/11/22 22:31:00
'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.

注销上面代码,单击目录树,正常,上面是哪些错,如何纠正?
8楼
有点蓝 发表于:2023/11/23 8:42:00
总共有几层表头?代码最大用到了3,有4层表头那么多?
9楼
有点蓝 发表于:2023/11/23 8:43:00
提示的是【表,窗口_Table1,DrawCell】这里代码错误,发上来呀
共9 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02808 s, 2 queries.