internal void FireDisplayGroup(GroupDisplayEventArgs e) { if (DisplayGroup != null) { DisplayGroup(this, e); } }
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 GetDisplayInfo(bool selected) { GroupDisplayEventArgs e = new GroupDisplayEventArgs(this, Owner.Source.GroupOn); e.Selected = selected; SetDisplayInfo(e); if (e.Cancel) { return(null); } Owner.Source.FireDisplayGroup(e); return(e); }
protected virtual void SetDisplayInfo(GroupDisplayEventArgs e) { var grid = Owner.Source.Grid; if (grid != null) { e.BackColor = e.Selected ? grid.DefaultCellStyle.SelectionBackColor : grid.DefaultCellStyle.BackColor; e.ForeColor = e.Selected ? grid.DefaultCellStyle.SelectionForeColor : grid.DefaultCellStyle.ForeColor; } var o = Owner.Source.Options; if (o.ShowCount) { e.Summary = "(" + Count + ")"; } if (o.ShowGroupName) { e.Header = e.GroupingInfo.ToString(); } e.GroupingInfo.SetDisplayValues(e); }
public override void SetDisplayValues(GroupDisplayEventArgs e) { base.SetDisplayValues(e); if (Mode == DateTimeGrouping.Date) { e.DisplayValue = ((DateTime)e.Value).ToShortDateString(); } else if (e.Value is int) { int i = (int)e.Value; string value = null; if (set(DateTimeGrouping.Year)) { value = "Year: " + i / 10000; } if (set(DateTimeGrouping.Month)) { if (value != null) { value += ", "; } int m = (i / 100) % 100; value += System.Globalization.DateTimeFormatInfo.CurrentInfo.GetMonthName(m); } if (set(DateTimeGrouping.Day) || set(DateTimeGrouping.WeekDay)) { if (value != null) { value += ", "; } int d = i % 10000; value += set(DateTimeGrouping.WeekDay) ? System.Globalization.DateTimeFormatInfo.CurrentInfo.GetDayName((DayOfWeek)d) : "Day: " + d; } e.DisplayValue = value; } }
public virtual void SetDisplayValues(GroupDisplayEventArgs e) { var o = e.Value; e.DisplayValue = o == null ? "<Null>" : o.ToString(); }
protected override void SetDisplayInfo(GroupDisplayEventArgs e) { base.SetDisplayInfo(e); e.Header = "New Rows"; e.DisplayValue = null; }