你在Winfroms板块发帖,所以我给你的是Winforms的代码,下次请在对应的XAML版本发帖
最好帖子中也明确使用的开发平台
定义一个CellFactory并给对应的单元格设置样式
- 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);
- }
- }
- }
复制代码
将flexgrid的cellfactory设置为定义的那个
- grid.CellFactory = new MyCellFactory();
复制代码 |