Sometimes totals are not simply a column of sums, maximums, averages, and so on. Many times it is calculated on the basis of total,
Direct on Dry Goods
Set the view. Columns[strcolumnname]. Summaryitem.summarytype = DevExpress.Data.SummaryItemType.Custom; set when setting the table header
Add Customsummarycalculate method
To calculate in a method
The following example is my own calculation of the consumption and unit income of the method itself to change according to their own circumstances
private void Bandedgridview1_customsummarycalculate (object sender, DevExpress.Data.CustomSummaryEventArgs e)
{
if (bandedgridview1.columns["F_licheng"]. Summaryitem.summaryvalue! = null && convert.todecimal (bandedgridview1.columns["F_licheng"]. Summaryitem.summaryvalue)! = 0)
{
Single consumption
bandedgridview1.columns["F_danhao"]. Summaryitem.setsummary (DevExpress.Data.SummaryItemType.Custom, Math.Round (Convert.todecimal ( bandedgridview1.columns["F_fuel"]. Summaryitem.summaryvalue)/Convert.todecimal (bandedgridview1.columns["F_licheng"]. Summaryitem.summaryvalue)) * 100, 2). ToString ());
Unit income
bandedgridview1.columns["F_danmoney"]. Summaryitem.setsummary (DevExpress.Data.SummaryItemType.Custom, Math.Round (Convert.todecimal ( bandedgridview1.columns["F_income"]. Summaryitem.summaryvalue)/Convert.todecimal (bandedgridview1.columns["F_licheng"]. Summaryitem.summaryvalue)) * 1000, 2). ToString ());
}
}
This article comes from the "pit of Idea essay" blog, make sure to keep this source http://smilesun.blog.51cto.com/3351150/1838037
Devpress Gridcontrol Total line Custom calculation formula