抱歉回复晚了,已经验证了,可以通过OwnerDraw事件,来重新设置统计行的计算值
DrawMode设置为CellOwnerDraw,然后在OwnerDraw事件中写如下代码,其中通过背景色来判断是否是统计行(给统计行设置了不同的背景色)
- private void _flex_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
- {
- if (e.Row>0&&e.Style.BackColor != Color.White && e.Col == _flex.Cols.Count - 1)
- {
- var a1 = _flex[e.Row, _flex.Cols.Count - 2];
- var a2 = _flex[e.Row, _flex.Cols.Count - 3];
- _flex[e.Row, _flex.Cols.Count - 1] = Convert.ToDouble(_flex[e.Row, _flex.Cols.Count - 2]) / Convert.ToDouble(_flex[e.Row, _flex.Cols.Count - 3]);
- }
- }
复制代码
|