gridViewmachinerepair.Columns["machine"].Group();
#region 自定义计算 double dateCount = 0; gridViewmachinerepair.CustomSummaryCalculate += (sender, e) => { if (e.IsGroupSummary) { GridView view = sender as GridView; switch (e.SummaryProcess) { //calculation entry point case CustomSummaryProcess.Start: dateCount = 0; break; //consequent calculations case CustomSummaryProcess.Calculate: double values = Convert.ToDouble(view.GetRowCellValue(e.RowHandle, view.Columns["outqty"])); //DateTime current = DateTime.Now; System.Globalization.CultureInfo cul = System.Globalization.CultureInfo.CurrentCulture; dateCount += values; break; //final summary value case CustomSummaryProcess.Finalize: e.TotalValue = dateCount; break; } } }; gridViewmachinerepair.GroupSummary.Add(SummaryItemType.Custom, "outqty", gridViewmachinerepair.Columns["outqty"], "出库数量:{0}"); #endregion
Working with Summaries in Code. Custom Summaries | WinForms Controls | DevExpress Documentation