Exemplo n.º 1
0
        /// <summary>
        /// Normalizes the user specified start and end dates
        /// </summary>
        /// <param name="startDate">[out] Normalized start date</param>
        /// <param name="endDate">[out] Normalized end date</param>
        protected override void NormalizeDates(out DateTime startDate, out DateTime endDate)
        {
            startDate = this.StartDate;
            endDate = this.EndDate;

            DaysOfTheWeek = new DaysOfTheWeek(startDate.DayOfWeek, DaysInWeek);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Normalizes the user specified start and end dates
        /// </summary>
        /// <param name="startDate">[out] Normalized start date</param>
        /// <param name="endDate">[out] Normalized end date</param>
        protected override void NormalizeDates(out DateTime startDate, out DateTime endDate)
        {
            startDate = this.StartDate;

            // If both values are unset, then set them to
            // today's date

            if (startDate == DateTime.MinValue)
                startDate = DateTime.Today.Date;

            endDate = startDate;

            DaysOfTheWeek = new DaysOfTheWeek(startDate.DayOfWeek, 1);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Normalizes the user specified start and end dates
        /// </summary>
        /// <param name="startDate">[out] Normalized start date</param>
        /// <param name="endDate">[out] Normalized end date</param>
        private void NormalizeDates(out DateTime startDate, out DateTime endDate)
        {
            startDate = this.StartDate.Date;
            endDate = this.EndDate.Date;

            // If both values are unset, then set them to
            // today's date / + 12 months

            if (startDate == DateTime.MinValue && endDate == DateTime.MinValue)
            {
                startDate = DateTime.Today.AddDays(-(DateTime.Today.Day - 1));
                endDate = startDate.AddMonths(12).AddDays(-1);
            }

            if (DaysOfTheWeek == null)
                DaysOfTheWeek = new DaysOfTheWeek();
        }
Exemplo n.º 4
0
        /// <summary>
        /// DrawColumnHeader
        /// </summary>
        /// <param name="g"></param>
        /// <param name="i"></param>
        /// <param name="type"></param>
        /// <param name="r"></param>
        /// <param name="br"></param>
        /// <param name="pen"></param>
        /// <param name="part"></param>
        private void DrawColumnHeader(Graphics g, int i,
            DaysOfTheWeek.eDayType type, Rectangle r, Brush br, Pen pen, eCalendarWeekDayPart part)
        {
            r.X = _DayColumns[i].Bounds.X;
            r.Width = _DayColumns[i].Bounds.Width;

            g.FillRectangle(br, r);
            g.DrawRectangle(pen, r);

            Rectangle t = r;

            if (CalendarView.DoPreRenderWeekDayHeader(g, this, i, t) == false)
            {
                // Draw the header text

                int n = i % DaysInWeek;

                eTextFormat tf = eTextFormat.VerticalCenter | eTextFormat.NoPadding;

                r.Inflate(-2, 0);
                r.X += 1;

                TextDrawing.DrawString(g,
                                       _DayColumns[i].Date.Day.ToString(), BoldFont, Color.Black, r, tf);

                r.X += _DayColumnSize[n].Width;
                r.Width -= _DayColumnSize[n].Width;

                if (type != DaysOfTheWeek.eDayType.None)
                {
                    tf |= eTextFormat.HorizontalCenter;

                    TextDrawing.DrawString(g, DaysOfTheWeek.DayText[(int) type][n],
                                           Font, _ViewColor.GetColor((int) part), r, tf);
                }

                CalendarView.DoPostRenderWeekDayHeader(g, this, i, t);
            }
        }