以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  窗体中的SQLQuery表 DrawCell 不起作用  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=150506)

--  作者:tld
--  发布时间:2020/5/31 23:28:00
--  窗体中的SQLQuery表 DrawCell 不起作用
老师,窗口2有个SQLQuery表,DrawCell事件没有起作用,请您给看看。谢谢了!
在窗口2 AfterLoad事件中,代码如下:
If tb0.Cols(tb0.ColSel).name = "检测_内容" Then
    Tables("窗口2_table1").DataSource = DataTables(jgb)
    Tables("窗口2_table1").Filter = cexp("[专业]=\'{0}\' and [次分类]=\'{1}\'and [选择规则]=\'{2}\' ",tb0.current("专业"),tb0.current("检测_类别"),"参数")
    Dim cvs As String="次分类|93|收费项目|151|单项价格|54|项目单位|80|检验条件|180|备注|120"
    Tables("窗口2_table1").SetColVisibleWidth(cvs)
End If
For Each dtb As DataTable In DataTables
    dtb.AddUserStyle("style_选中", Color.CornflowerBlue, Color.white) 
Next
-------------------------------------------------------------------------------------
该表的 DrawCell事件中代码如下:
 If e.Row.Checked =True Then
    e.Style = "style_选中"
End If
-------------------------------------------------------------------------------------------------------

选中该行,checked = true,DrawCell事件不起作用(会偶尔起作用一次,之后就不起作用)
我在AfterLoad事件中加入如下代码:
    DataTables(jgb).AddUserStyle("style_选中", Color.CornflowerBlue, Color.white) 
也不行。
 

[此贴子已经被作者于2020/5/31 23:30:50编辑过]

--  作者:有点蓝
--  发布时间:2020/6/1 8:34:00
--  
 DrawCell事件放到全局表事件的DrawCell:http://www.foxtable.com/webhelp/topics/0671.htm

AfterLoad事件中,代码如下:
If tb0.Cols(tb0.ColSel).name = "检测_内容" Then
    Tables("窗口2_table1").DataSource = DataTables(jgb)
    Tables("窗口2_table1").Filter = cexp("[专业]=\'{0}\' and [次分类]=\'{1}\'and [选择规则]=\'{2}\' ",tb0.current("专业"),tb0.current("检测_类别"),"参数")
    Dim cvs As String="次分类|93|收费项目|151|单项价格|54|项目单位|80|检验条件|180|备注|120"
    Tables("窗口2_table1").SetColVisibleWidth(cvs)
End If
Tables("窗口2_table1").DataTable.AddUserStyle("style_选中", Color.CornflowerBlue, Color.white)
Tables("窗口2_table1").DataTable.GlobalHandler.DrawCell = True

--  作者:tld
--  发布时间:2020/6/1 11:45:00
--  
谢谢蓝版主。请教,什么情况下需要放到全局表事件?
--  作者:有点蓝
--  发布时间:2020/6/1 11:49:00
--  
DataSource、fill这种改变表格绑定的,可以都放到全局表事件