Devexpress分组小计


            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

 

第二种:

这样设置:

posted on 2021-05-20 16:10  RookieBoy666  阅读(333)  评论(0编辑  收藏  举报