Example #1
0
        /// <summary>
        /// DrawHourBorders
        /// </summary>
        /// <param name="g"></param>
        /// <param name="colStart"></param>
        /// <param name="colEnd"></param>
        /// <param name="bounds"></param>
        /// <param name="states"></param>
        private void DrawHourBorders(Graphics g,
            int colStart, int colEnd, Rectangle bounds, eSlotDisplayState[] states)
        {
            // Draw the vertical hour borders

            using (Pen pen = new Pen(
                _ViewColor.GetColor((int)eCalendarWeekDayPart.DayHourBorder)))
            {
                Point pt1 = new Point(bounds.X, ClientRect.Y);
                Point pt2 = new Point(bounds.X, ClientRect.Bottom - 1);

                for (int i = colStart; i <= colEnd; i++)
                {
                    if (CalendarView.DoTimeLineViewRenderSlotBorder(
                        g, this, i, true, states[i - colStart], pt1, pt2, pen) == false)
                    {
                        g.DrawLine(pen, pt1, pt2);
                    }

                    pt1.X = pt2.X = (pt1.X + ColumnWidth);
                }
            }
        }
Example #2
0
        /// <summary>
        /// DrawHalfHourBorders
        /// </summary>
        /// <param name="g"></param>
        /// <param name="colStart"></param>
        /// <param name="colEnd"></param>
        /// <param name="bounds"></param>
        /// <param name="states"></param>
        private void DrawHalfHourBorders(Graphics g,
            int colStart, int colEnd, Rectangle bounds, eSlotDisplayState[] states)
        {
            // Draw the vertical hour and half hour borders

            using (Pen pen1 = new Pen(
                _ViewColor.GetColor((int)eCalendarWeekDayPart.DayHourBorder)))
            {
                using (Pen pen2 = new Pen(
                    _ViewColor.GetColor((int)eCalendarWeekDayPart.DayHalfHourBorder)))
                {
                    Point pt1 = new Point(bounds.X, ClientRect.Y);
                    Point pt2 = new Point(bounds.X, ClientRect.Bottom - 1);

                    int n = 60 / CalendarView.TimeLineInterval;
                    int start = -_HScrollPos / ColumnWidth;

                    for (int i = colStart; i <= colEnd; i++)
                    {
                        bool isHour = (i == start || (i % n) == 0);
                        Pen pen = (isHour ? pen1 : pen2);

                        if (CalendarView.DoTimeLineViewRenderSlotBorder(
                            g, this, i, isHour, states[i - colStart], pt1, pt2, pen) == false)
                        {
                            g.DrawLine((isHour ? pen1 : pen2), pt1, pt2);
                        }

                        pt1.X = pt2.X = (pt1.X + ColumnWidth);
                    }
                }
            }
        }
Example #3
0
        /// <summary>
        /// Draws the TimeLine border
        /// </summary>
        /// <param name="g"></param>
        /// <param name="colStart">Starting column</param>
        /// <param name="colEnd">Ending column</param>
        /// <param name="states"></param>
        private void DrawBorder(Graphics g,
            int colStart, int colEnd, eSlotDisplayState[] states)
        {
            Rectangle r = GetColRect(colStart);

            // Draw the vertical borders

            if (CalendarView.TimeLinePeriod == eTimeLinePeriod.Minutes)
                DrawHalfHourBorders(g, colStart, colEnd, r, states);
            else
                DrawHourBorders(g, colStart, colEnd, r, states);

            // Now draw the horizontal border

            using (Pen pen1 = new Pen(
                _ViewColor.GetColor((int)eCalendarWeekDayPart.DayViewBorder)))
            {
                Point pt1 = new Point(r.X, ClientRect.Bottom - 1);
                Point pt2 = new Point(r.X + (colEnd - colStart + 1) * ColumnWidth, pt1.Y);

                g.DrawLine(pen1, pt1, pt2);

                if (CalendarView.TimeLineShowPeriodHeader == false &&
                    CalendarView.TimeLineShowIntervalHeader == false)
                {
                    pt1 = new Point(r.X, ClientRect.Top);
                    pt2 = new Point(r.X + (colEnd - colStart + 1) * ColumnWidth, pt1.Y);

                    g.DrawLine(pen1, pt1, pt2);
                }
            }
        }
Example #4
0
        /// <summary>
        /// Gets the background content brush
        /// for the given time slice
        /// </summary>
        /// <returns>Background brush</returns>
        private Brush GetContentBrush(eSlotDisplayState state)
        {
            if ((state & eSlotDisplayState.Selected) == eSlotDisplayState.Selected)
                return (SelectedBrush);

            if ((state & eSlotDisplayState.Work) == eSlotDisplayState.Work)
                return (WorkBrush);

            return (OffWorkBrush);
        }
Example #5
0
        /// <summary>
        /// Draws the content area of the TimeLine
        /// </summary>
        /// <param name="g"></param>
        /// <param name="colStart">Starting column</param>
        /// <param name="colEnd">Ending column</param>
        /// <param name="states"></param>
        private void DrawContent(Graphics g,
            int colStart, int colEnd, eSlotDisplayState[] states)
        {
            Rectangle r = GetColRect(colStart);

            if (CalendarView.HasTimeLineSlotBackgroundCallout == true)
            {
                for (int i = colStart; i <= colEnd; i++)
                {
                    int n = i - colStart;

                    DateTime startTime = StartDate.AddMinutes(i * BaseInterval);
                    DateTime endTime = startTime.AddMinutes(BaseInterval);

                    if (CalendarView.DoTimeLineViewPreRenderSlotBackground(
                        g, this, startTime, endTime, r, ref states[n]) == false)
                    {
                        g.FillRectangle(GetContentBrush(states[n]), r);

                        DrawCollateLines(g, r);

                        CalendarView.DoTimeLineViewPostRenderSlotBackground(
                            g, this, startTime, endTime, r, states[n]);
                    }

                    r.X += ColumnWidth;
                }
            }
            else
            {
                Rectangle t = r;

                for (int i = 0; i <= colEnd - colStart; i++)
                {
                    g.FillRectangle(GetContentBrush(states[i]), t);

                    t.X += ColumnWidth;
                }

                r.Width += (t.Right - r.Right);

                DrawCollateLines(g, r);
            }
        }
Example #6
0
        /// <summary>
        /// Initiates the drawing of the TimeLine
        /// </summary>
        /// <param name="g">Graphics</param>
        /// <param name="colStart">Starting column</param>
        /// <param name="colEnd">Ending column</param>
        private void DrawTimeLine(Graphics g, int colStart, int colEnd)
        {
            int n = colEnd - colStart;

            eSlotDisplayState[] states = new eSlotDisplayState[n + 1];

            for (int i = 0; i <= n; i++)
                states[i] = GetSlotState(colStart + i);

            DrawContent(g, colStart, colEnd, states);
            DrawBorder(g, colStart, colEnd, states);

            DrawTimeIndicators(g, colStart, colEnd);
        }