1.效果图
2.实现代码
List<GridColumn> columns = new List<GridColumn>(); columns.Add(new GridColumn() { Caption = "使用人", ParentGroupKey = "使用", DataType = typeof(string), Field = nameof(ChgRcptStatisticalVo.UserName), Visible = true, Width = 100 }); columns.Add(new GridColumn() { Caption = "正常", ParentGroupKey = "使用", DataType = typeof(string), Field = nameof(ChgRcptStatisticalVo.NormalSum), Visible = true, Width = 100 }); columns.Add(new GridColumn() { Caption = "重打", ParentGroupKey = "使用", DataType = typeof(string), Field = nameof(ChgRcptStatisticalVo.NormalReTypeSum), Visible = true, Width = 100 }); columns.Add(new GridColumn() { Caption = "报损", ParentGroupKey = "使用", DataType = typeof(string), Field = nameof(ChgRcptStatisticalVo.NormalBreakdownSum), Visible = true, Width = 100 }); columns.Add(new GridColumn() { Caption = "总数", ParentGroupKey = "使用", DataType = typeof(string), Field = nameof(ChgRcptStatisticalVo.UseSum), Visible = true, Width = 100 }); columns.Add(new GridColumn() { Caption = "作废", ParentGroupKey = "收回", DataType = typeof(string), Field = nameof(ChgRcptStatisticalVo.RecycleInvalidSum), Visible = true, Width = 100 }); columns.Add(new GridColumn() { Caption = "重打", ParentGroupKey = "收回", DataType = typeof(string), Field = nameof(ChgRcptStatisticalVo.RecycleRetypeSum), Visible = true, Width = 100 }); columns.Add(new GridColumn() { Caption = "总数", ParentGroupKey = "收回", DataType = typeof(string), Field = nameof(ChgRcptStatisticalVo.RecoverySum), Visible = true, Width = 100 }); dgvMain.InitColumns(columns);