Foxtable(狐表)用户栏目专家坐堂 → 选定区域的背景色


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

主题:选定区域的背景色

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


加好友 发短信
等级:小狐 帖子:393 积分:3723 威望:0 精华:0 注册:2013/10/9 23:09:00
选定区域的背景色  发帖心情 Post By:2016/1/11 23:29:00 [只看该作者]

请教老师:

1、窗口的table的选定区域的默认背景色可以设置吗?不要UseVisualStyle ,这会改变表格的立体化的表头;

2、我用如下程序临时标注了下背景色后,再取消后,选定区域的背景色竟然不着色了,何解?

Dim r As Row=args(0)
Dim cs1 As C1.Win.C1FlexGrid.CellStyle= Tables("主窗口表").grid.Styles.Add("选中样式")
cs1.foreColor =Color.red
cs1.backColor =Color.Khaki

Dim cs2 As C1.Win.C1FlexGrid.CellStyle= Tables("主窗口表").grid.Styles.Add("未选样式")
cs2.foreColor =Color.black
cs2.backColor =Color.white

For Each c As Col In r.Table.Cols
    If r.Checked Then
        r.Table.Grid.SetCellStyle(r.Table.HeaderRows+r.Index,c.Index+1,cs1)
    Else
        r.Table.Grid.SetCellStyle(r.Table.HeaderRows+r.Index,c.Index+1,cs2)
    End If
Next

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/1/12 0:04:00 [只看该作者]

1、mark 选中颜色,drawcell事件

 

Dim cl = e.Table.grid.getCellRange(e.Row.index+1, e.Col.index+1)
If e.Row.Index > = e.Table.TopPosition AndAlso e.Row.Index <= e.Table.BottomPosition AndAlso e.Col.Index >= e.Table.LeftCol AndAlso e.Col.Index <= e.Table.RightCol Then
    If cl.style Is Nothing Then
        Dim cs1 As C1.Win.C1FlexGrid.CellStyle=e.Table.grid.Styles.Add("选中样式")
        cs1.foreColor=Color.red
        cs1.backColor =Color.Khaki
        cl.style=cs1
    Else
        cl.style.foreColor=Color.red
        cl.style.backColor =Color.Khaki
    End If
Else
    cl.style = Nothing
End If


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/1/12 0:05:00 [只看该作者]

2、这段代码应该是没问题的。加入msgbox,看看是否触发了事件。

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


加好友 发短信
等级:小狐 帖子:393 积分:3723 威望:0 精华:0 注册:2013/10/9 23:09:00
  发帖心情 Post By:2016/1/12 0:07:00 [只看该作者]

就是什么情况下会造成选定区域无法正常显示默认的背景色?

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/1/12 0:10:00 [只看该作者]

以下是引用hdffzxf在2016/1/12 0:07:00的发言:
就是什么情况下会造成选定区域无法正常显示默认的背景色?

 

使用风格,就不能显示自己设置的背景颜色。默认就是高亮的蓝色。


 回到顶部