回复 8楼willian的帖子
可以通过C1FlexGrid的CellFactory设置单元格的边框,非表头部分的。
代码参考:
- public class MyCellFactory : C1.WPF.FlexGrid.CellFactory
- {
- List<C1.WPF.FlexGrid.CellRange> crw = new List<C1.WPF.FlexGrid.CellRange>();
- public MyCellFactory()
- {
- crw.Add(new C1.WPF.FlexGrid.CellRange(0,0));
- crw.Add(new C1.WPF.FlexGrid.CellRange(1,1));
- crw.Add(new C1.WPF.FlexGrid.CellRange(2,2));
- crw.Add(new C1.WPF.FlexGrid.CellRange(3,3));
- }
-
- public override Border CreateCellBorder(C1.WPF.FlexGrid.C1FlexGrid grid, C1.WPF.FlexGrid.CellType cellType, C1.WPF.FlexGrid.CellRange rng)
- {
- Border bdr = base.CreateCellBorder(grid, cellType, rng);
-
- if (cellType == C1.WPF.FlexGrid.CellType.Cell)
- if (crw.Contains(rng))
- {
- VisualBrush vb = new VisualBrush();
- vb.Visual = new Rectangle() { Height = 10, Width = 40, Stroke = new SolidColorBrush(Colors.Red), StrokeDashArray = new DoubleCollection() { 1.0 } };
-
- bdr.BorderThickness = new Thickness(2, 2, 2, 2);
- bdr.BorderBrush = vb;
- }
-
- return bdr;
- }
-
- }
复制代码
表头部分单元格暂时没提供。 |