第一步:
注册事件
gridView.CustomDrawFooterCell += new DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventHandler(GridViewMain_CustomDrawFooterCell);
第二步:
重写事件
void GridViewMain_CustomDrawFooterCell(object sender, DevExpress.XtraGrid.Views.Grid.FooterCellCustomDrawEventArgs e)
{
if (e.Column.SummaryItem.SummaryType == DevExpress.Data.SummaryItemType.Sum)
{
e.Info.DisplayText = Convert.ToString(e.Info.Value);// amount.ToString("¥0.0000");
}
}
运行代码就可以了;
原来的写法:
column.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum;
columns.SummaryItem.DisplayFormat = "{0:c4}";
显示效果不是很理想:
预期效果为:0.148 ==> 实际显示效果为:0.1500