抱歉没有看清楚你的开发平台,WPF中稍微麻烦一些,需要自定义一个CellFectory,具体代码如下
- //加载时设置
- grid.CellFactory = new MyCellFactory();
- public class MyCellFactory : CellFactory
- {
- public override void ApplyCellStyles(C1FlexGrid grid, CellType cellType, CellRange rng, Border bdr)
- {
- var columnindex = rng.Column;
- var rowindex = rng.Row;
- if ((columnindex == 2) && (rowindex == 3))
- {
- // set the customizations on the cell when it is not selected
- bdr.Background = new SolidColorBrush(Colors.Red);
- bdr.BorderBrush = Brushes.Blue;
- bdr.BorderThickness = new Thickness(1);
- }
- }
- }
复制代码
|