以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  单元格底色  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=179881)

--  作者:shqpldczj
--  发布时间:2022/9/15 15:07:00
--  单元格底色
菜单栏有的颜色调色板,我想在主窗口的表选中单元格后在调色板选择颜色后单元格的底色变色怎么写代码
--  作者:有点蓝
--  发布时间:2022/9/15 15:52:00
--  
Dim t As Table = Tables("表A")
Dim cr1 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add("a") \' 创建一个新的自定义样式
cr1.BackColor = Color.Red
cr1.ForeColor = Color.White
Dim rg As C1.Win.C1FlexGrid.CellRange = t.Grid.GetCellRange(t.RowSel + 1, t.ColSel + 1, t.RowSel + 1, t.ColSel + 1)
rg.Style = cr1

--  作者:shqpldczj
--  发布时间:2022/9/15 16:35:00
--  颜色选择
现在这样只能是一个颜色红底白字,我想在调色板选什么颜色单元格就是什么颜色


--  作者:shqpldczj
--  发布时间:2022/9/15 16:38:00
--  菜单按钮
我的菜单按钮是颜色选取按钮
--  作者:有点蓝
--  发布时间:2022/9/15 16:53:00
--  
SelectedColorChange事件

cr1.BackColor = e.ColorPicker.Color
--  作者:shqpldczj
--  发布时间:2022/9/15 20:05:00
--  单元格变色问题
老大现在代码这样我在颜色选取按钮的click和selectedcolorchanged里都写了
Dim t As Table = Tables("合同主表")
Dim cr1 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add("a") \' 创建一个新的自定义样式
cr1.BackColor = e.ColorPicker.Color
Dim rg As C1.Win.C1FlexGrid.CellRange = t.Grid.GetCellRange(t.RowSel + 1, t.ColSel + 1, t.RowSel + 1, t.ColSel + 1)
rg.Style = cr1
现在的问题是我选一个单元格变色,第二个选择变色,第三个我换一个颜色原来的就全变心选的颜色了


--  作者:有点蓝
--  发布时间:2022/9/15 20:08:00
--  
Dim cr1 As C1.Win.C1FlexGrid.CellStyle = t.Grid.Styles.Add(t.RowSel & “” & t.ColSel)
[此贴子已经被作者于2022/9/15 20:08:16编辑过]

--  作者:shqpldczj
--  发布时间:2022/9/15 20:22:00
--  不行,还是全部变色
还是不行另选颜色后,前面变色的单元格也一起变了

图片点击可在新窗口打开查看此主题相关图片如下:变色.png
图片点击可在新窗口打开查看


--  作者:shqpldczj
--  发布时间:2022/9/15 20:29:00
--  查了帖子
Dim r As Integer = CurrentTable.RowSel+1
Dim c As Integer = CurrentTable.ColSel+1

Dim s As C1.Win.C1FlexGrid.CellStyle = CurrentTable.grid.Styles.Add(r & "-" & c)
s.ForeColor = e.ColorPicker.Color
CurrentTable.Grid.SetCellStyle(CurrentTable.RowSel+1, CurrentTable.ColSel+1, s)


这个改成back就好了,但是颜色怎么保存?


--  作者:shqpldczj
--  发布时间:2022/9/15 20:50:00
--  参照帖子
单元格颜色变色后不能保存
[此贴子已经被作者于2022/9/15 21:00:43编辑过]