GroupDisplayEventArgs GetDisplayValues(DataGridViewRowPrePaintEventArgs pe) { IGroupRow row = source[pe.RowIndex] as IGroupRow; GroupDisplayEventArgs e = new GroupDisplayEventArgs(row, source.GroupOn); bool selected = selectedrows.Contains(pe.RowIndex); e.Selected = selected; e.BackColor = selected ? grid.DefaultCellStyle.SelectionBackColor : grid.DefaultCellStyle.BackColor; e.ForeColor = selected ? grid.DefaultCellStyle.SelectionForeColor : grid.DefaultCellStyle.ForeColor; e.Font = pe.InheritedRowStyle.Font; if (showcount) { e.Summary = "(" + row.Count + ")"; } if (showheader) { e.Header = source.GroupOn.ToString(); } e.GroupingInfo.SetDisplayValues(e); if (e.Cancel) { return(null); } if (DisplayGroup != null) { DisplayGroup(this, e); if (e.Cancel) { return(null); } } return(e); }
public GroupDisplayEventArgs(IGroupRow Row, GroupingInfo Info) { this.Row = Row; this.GroupingInfo = Info; }