Foxtable(狐表)用户栏目专家坐堂 → [求助]按条件实现表格填充样式?


  共有2291人关注过本帖树形打印复制链接

主题:[求助]按条件实现表格填充样式?

帅哥哟,离线,有人找我吗?
ufo20085
  11楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:196 积分:2913 威望:0 精华:0 注册:2016/8/31 14:05:00
  发帖心情 Post By:2018/7/20 21:40:00 [只看该作者]

以下是引用有点甜在2018/7/20 16:28:00的发言:

先点击排序,再分析

 

Dim t As Table = Tables("同品名异归类")
Dim cs1 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add("样式1")
cs1.backcolor = Color.red
Dim cs2 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add("样式2")
cs2.backcolor = Color.green
Dim idx = t.grid.Cols("商品编码").Index
For i As Integer = t.Position To t.Rows.count-1
   
    If i <> t.Position Then
        If t.Rows(i)("商品名称") <> t.Rows(i-1)("商品名称") Then
            t.position = i
            Exit For
        End If
        If t.Rows(i)("商品编码") <> t.Rows(i-1)("商品编码") Then
            t.Grid.SetCellStyle(i+1, idx, cs2)
        Else
            t.Grid.SetCellStyle(i+1, idx, cs1)
        End If
    Else
        t.Grid.SetCellStyle(i+1, idx, cs1)
    End If
Next

l老师,请看6楼的附件。。问题还是没解决,相同的商品编码,却有不同的颜色这个bug还是存在。。。 同时想实现分析下一个商品时,上一个商品的颜色标注去掉,只显示当前分析的商品有颜色。。。不知道该怎么写

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  12楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107861 积分:548662 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/7/20 22:10:00 [只看该作者]

Dim t As Table = Tables("同品名异归类")
Dim cs1 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add("样式1")
cs1.backcolor = Color.red
Dim cs2 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add("样式2")
cs2.backcolor = Color.green
Dim idx = t.grid.Cols("商品编码").Index
For i As Integer = 0 To t.Position
    t.Grid.SetCellStyle(i, idx, "")
Next
For i As Integer = t.Position To t.Rows.count-1
    
    If i <> t.Position Then
        If t.Rows(i)("商品名称") <> t.Rows(i-1)("商品名称") Then
            t.position = i
            Exit For
        End If
        If t.Rows(i)("商品编码") <> t.Rows(i-1)("商品编码") Then
            t.Grid.SetCellStyle(i+1, idx, cs2)
            Dim c = cs1
            cs1 = cs2
            cs2 = c
        Else
            t.Grid.SetCellStyle(i+1, idx, cs1)
        End If
    Else
        t.Grid.SetCellStyle(i+1, idx, cs1)
    End If
Next

 回到顶部
总数 12 上一页 1 2