コード例 #1
0
 internal void FireDisplayGroup(GroupDisplayEventArgs e)
 {
     if (DisplayGroup != null)
     {
         DisplayGroup(this, e);
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 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;
     }
 }
コード例 #6
0
        public virtual void SetDisplayValues(GroupDisplayEventArgs e)
        {
            var o = e.Value;

            e.DisplayValue = o == null ? "<Null>" : o.ToString();
        }
コード例 #7
0
 protected override void SetDisplayInfo(GroupDisplayEventArgs e)
 {
     base.SetDisplayInfo(e);
     e.Header       = "New Rows";
     e.DisplayValue = null;
 }