以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  如何绘制符合条件的整个列  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=107824)

--  作者:zhangchi96
--  发布时间:2017/10/10 23:56:00
--  如何绘制符合条件的整个列
 

Drawcell代码:

 

DataTables("网络总课表").AddUserStyle("草绿蓝", Color.GreenYellow, Color.DarkBlue )

DataTables("网络总课表").AddUserStyle("灰蓝", Color.Gainsboro, Color.Blue)

Dim r As Row = Tables("网络教师课务明细表").current

Dim z1() As String = { "周1_1","周1_2","周1_3","周1_4","周1_5","周1_6","周1_7","周2_1","周2_2","周2_3","周2_4","周2_5","周2_6","周2_7","周3_1","周3_2","周3_3","周3_4","周3_5","周3_6","周3_7","周4_1","周4_2","周4_3","周4_4","周4_5","周4_6","周4_7","周5_1","周5_2","周5_3","周5_4","周5_5","周5_6","周5_7" }

    For Each dc2  As String  In z1

        If e.Col.name = dc2 AndAlso r IsNot Nothing Then

            If  e.Row("年级") = r("年级") And e.Row("班级") = r("班级") Then

                If e.Row(e.Col.name) = r("学科") Then

                   e.Style = "草绿蓝"

                End If

            End If

        End If

      Next

 

以上是符合的单元格显示草绿蓝,如果把该单元格所在的整个列显示灰蓝,请教老师,该加什么代码?


--  作者:有点甜
--  发布时间:2017/10/11 9:37:00
--  

DataTables("网络总课表").AddUserStyle("草绿蓝", Color.GreenYellow, Color.DarkBlue )

DataTables("网络总课表").AddUserStyle("灰蓝", Color.Gainsboro, Color.Blue)

Dim r As Row = Tables("网络教师课务明细表").current

Dim z1() As String = { "周1_1","周1_2","周1_3","周1_4","周1_5","周1_6","周1_7","周2_1","周2_2","周2_3","周2_4","周2_5","周2_6","周2_7","周3_1","周3_2","周3_3","周3_4","周3_5","周3_6","周3_7","周4_1","周4_2","周4_3","周4_4","周4_5","周4_6","周4_7","周5_1","周5_2","周5_3","周5_4","周5_5","周5_6","周5_7" }

If array.indexof(z1, e.Col.name) >= 0 Then
    For Each nr As Row In e.Table.rows
        If  nr("年级") = r("年级") And nr("班级") = r("班级") Then
            If nr(e.Col.name) = r("学科") Then
                e.Style = "灰蓝"

                exit for
            End If
        End If
    next
end if

If  e.Row("年级") = r("年级") And e.Row("班级") = r("班级") Then
    If e.Row(e.Col.name) = r("学科") Then
        e.Style = "草绿蓝"
    End If 
End If

 


--  作者:zhangchi96
--  发布时间:2017/10/11 11:44:00
--  
array.indexof(z1, e.Col.name) >= 0  这个语句不怎么好理解,能不能换其他的语句,感觉是间接查看是否包含的意思
--  作者:有点甜
--  发布时间:2017/10/11 12:05:00
--  
以下是引用zhangchi96在2017/10/11 11:44:00的发言:
array.indexof(z1, e.Col.name) >= 0  这个语句不怎么好理解,能不能换其他的语句,感觉是间接查看是否包含的意思

 

不判断也可以,去掉这个判断也不会有错。

 

http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece7631049963045438014638c81552295ce1cd5735b36163bbca66f780704a594207a5ff4191cb9b07d6f675321bd9ac28949cabbe57b6eca6d203541c6171d8059ef980d32c151cb06bff853f0bb806fc7b9d2a280150596&p=907fde0d86cc42ae58b6c7710f409e&newp=92759a46d7c31dbe18be9b7c460886231610db2151d7d6166b82c825d7331b001c3bbfb423241506d9c37d6701a44b5aedf73672310221a3dda5c91d9fb4c57479d43674&user=baidu&fm=sc&query=array+indexof+msdn&qid=e4ca01da00016449&p1=1