解决方法
您可以尝试使用垂直单元格合并的MSFlexGrid MergeCells属性的功能,而不是本文第
DataGridView Grouping in C#/VB.NET: Two Recipes条中所述的行分组.在此示例中,属于组的行使用垂直合并的单元格可视地连接 – 而不是使用传统的水平组行.
protected override void OnCellPainting(DataGridViewCellPaintingEventArgs args) { base.OnCellPainting(args); args.AdvancedBorderStyle.Bottom = DataGridViewAdvancedCellBorderStyle.None; // Ignore column and row headers and first row if (args.RowIndex < 1 || args.ColumnIndex < 0) return; if (IsRepeatedCellValue(args.RowIndex,args.ColumnIndex)) { args.AdvancedBorderStyle.Top = DataGridViewAdvancedCellBorderStyle.None; } else { args.AdvancedBorderStyle.Top = AdvancedCellBorderStyle.Top; } }