以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  求助!SQL Table表列一为值1时字体颜色的设置?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=4928)

--  作者:baoxyang
--  发布时间:2009/11/9 18:20:00
--  求助!SQL Table表列一为值1时字体颜色的设置?
目的,判断为SQL Table(窗口中的表)某列值为“A”时字体颜色为白色,为“B”时字体颜色为红色。请问下代码应如何写?
--  作者:mr725
--  发布时间:2009/11/9 19:06:00
--  

帮助中的DrawCell 不知道对窗口中的table有没有效果,反正我没有试过。  你可以试一试呀~


--  作者:baoxyang
--  发布时间:2009/11/9 21:35:00
--  
在窗口AfterLoad事件中如下代码:

DataTables("车辆状态管理_Table1").Styles("空闲").ForeColor = Color.Green
DataTables("车辆状态管理_Table1").Styles("中转").ForeColor = Color.Blue
DataTables("车辆状态管理_Table1").Styles("配送").ForeColor = Color.plum
DataTables("车辆状态管理_Table1").Styles("维修").ForeColor = Color.Red
DataTables("车辆状态管理_Table1").Styles("预报空闲").ForeColor = Color.Orange
DataTables("车辆状态管理_Table1").Styles("已计划").ForeColor = Color.Aqua


DrawCell
事件中如下代码:
If e.Col.Name = "状态" Then
    If e.Row.IsNull("状态") = False
        If e.Row("状态") = "空闲" Then
            e.Style = "空闲"
        else If e.Row(e.Col.Name) = "中转" Then
            e.Style = "中转"
        else If e.Row(e.Col.Name) = "配送" Then
            e.Style = "配送"
        else If e.Row(e.Col.Name) = "维修" Then
            e.Style = "维修"
        else If e.Row(e.Col.Name) = "预报空闲" Then
            e.Style = "预报空闲"
        else If e.Row(e.Col.Name) = "已计划" Then
            e.Style = "已计划"
        End If
    End If
End If

请指点以上代码哪里有问题,谢谢!

--  作者:czy
--  发布时间:2009/11/10 0:18:00
--  
好象只需这样就可以吧?

If e.Col.Name = "状态" Then
    If e.Row.IsNull("状态") = False
        e.Style = e.Row(e.Col.Name)
    End If
End If

--  作者:baoxyang
--  发布时间:2009/11/10 8:42:00
--  

同样是没有反映(不出效果),请老大帮看看是怎回事?