以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]记录窗口颜色  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=92308)

--  作者:llh0824
--  发布时间:2016/10/31 16:20:00
--  [求助]记录窗口颜色
为什么记录窗口中第一列用代码设置颜色之后,预览单击设置颜色的单元格,单元格颜色就变成和没有设置过的一样,但是第二列设置颜色之后却是正常的

    Dim cmd1 As new SQLCommand
    Dim dt1 As DataTable
    cmd1.C
    cmd1.CommandText = " select * fro m 单据模板表 where 表名 = \'物料表\' and 是否必填 = 1"
    dt1 = cmd1.ExecuteReader()
    
    Dim t As Table = rg.Table
    Dim g As object  = rg.basecontrol
    Dim cs1 As C1.Win.C1FlexGrid.CellStyle = g.Styles.Add("样式1")
    cs1.backcolor = Color.LemonChiffon
    
    For Each r2 As object In g.rows
        For Each c As Col In t.cols
            If c.Name = r2(0) Then   \'\'\'\'\'\'\'\'c.Caption = r2(0) Then
                For Each r1 As DataRow In dt1.DataRows
                    If c.Name = r1("字段") Then
                        g.SetCellStyle(r2.index, 0, cs1)
                    End If
                Next
            End If
        Next
    Next 
[此贴子已经被作者于2016/10/31 16:36:44编辑过]

--  作者:有点蓝
--  发布时间:2016/10/31 16:30:00
--  
代码呢?截图,例子
--  作者:llh0824
--  发布时间:2016/10/31 16:37:00
--  
代码补上了
--  作者:有点蓝
--  发布时间:2016/10/31 17:42:00
--  
没有看出什么问题。上例子看看