/// <summary> /// Collects the day info objects to produce rendering in one pass after sorting. /// </summary> private List <DayInfo> CollectDays(MonthInfo month, SizeF dayCellSize, ref float topOffset) { List <DayInfo> days = new List <DayInfo>(); for (int iWeek = 0; iWeek < CalendarData.WeeksInMonth; iWeek++) { // measure the actual height of the week row SizeF weekRowSize = CalendarData.MeasureWeek(month, iWeek, dayCellSize); if (weekRowSize.Height < dayCellSize.Height) { weekRowSize.Height = dayCellSize.Height; } // measure the day header SizeF dayHeaderSize = CalendarData.GetDayHeaderSize(dayCellSize); for (int iDay = 0; iDay < CalendarData.DaysInWeek; iDay++) { // get the date of day to draw DateTime dayDate = month.GetDateOfDay(iWeek, CalendarData.WeekDays[iDay], CalendarData.FirstDayOfWeek); DayInfo day = new DayInfo(dayDate); day.DayKind = month.DetermineDayKindForDate(dayDate); day.Label = dayDate.Day.ToString(CalendarData.Culture); day.HeaderSize = dayHeaderSize; if (!_rightToLeft) { day.Bounds = new RectangleF( CalendarArea.X + (iDay * dayCellSize.Width), CalendarArea.Y + topOffset, dayCellSize.Width, weekRowSize.Height); } else { day.Bounds = new RectangleF( (CalendarArea.X + CalendarArea.Width) - ((iDay + 1) * dayCellSize.Width), CalendarArea.Y + topOffset, dayCellSize.Width, weekRowSize.Height); } days.Add(day); } // get offset //topOffset += dayHeaderSize.Height; topOffset += weekRowSize.Height; } return(days); }