Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MonthViewMonth"/> class.
        /// </summary>
        /// <param name="monthView">The month view.</param>
        /// <param name="date">The date.</param>
        internal MonthViewMonth(MonthView monthView, DateTime date)
        {
            if (date.Day != 1)
            {
                date = new DateTime(date.Year, date.Month, 1);
            }


            _monthview = monthView;
            _date      = date;

            int preDays = (new int[] { 0, 1, 2, 3, 4, 5, 6 })[(int)date.DayOfWeek] - (int)MonthView.FirstDayOfWeek;

            days = new MonthViewDay[6 * 7];
            DateTime curDate = date.AddDays(-preDays);

            DayHeaders = new string[7];

            for (int i = 0; i < days.Length; i++)
            {
                days[i] = new MonthViewDay(this, curDate);

                if (i < 7)
                {
                    DayHeaders[i] = curDate.ToString(MonthView.DayNamesFormat).Substring(0, MonthView.DayNamesLength);
                }

                curDate = curDate.AddDays(1);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MonthViewDay"/> class.
 /// </summary>
 /// <param name="month">The month.</param>
 /// <param name="date">The date.</param>
 internal MonthViewDay(MonthViewMonth month, DateTime date)
 {
     _month     = month;
     _monthView = month.MonthView;
     _date      = date;
 }