Exemple #1
0
        /// <summary>
        /// Gets the TimeIndicator Rectangle for the given date
        /// </summary>
        /// <param name="ti"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        internal override Rectangle GetIndicatorRect(TimeIndicator ti, DateTime time)
        {
            int colStart = -_HScrollPos / ColumnWidth;
            DateTime startDate = CalendarView.TimeLineAddInterval(StartDate, colStart);

            double x = ColumnWidth / CalendarView.BaseInterval;
            int offset = (int)((time - startDate).TotalMinutes * x);

            Rectangle r = GetColRect(colStart);

            r.X += (offset - ti.Thickness - 1);
            r.Width = ti.Thickness;

            return (r);
        }
Exemple #2
0
        /// <summary>
        /// Gets the TimeIndicator Rectangle
        /// </summary>
        /// <param name="ti"></param>
        /// <param name="startDate"></param>
        /// <param name="sRect"></param>
        /// <returns></returns>
        private Rectangle GetIndicatorRect(
            TimeIndicator ti, DateTime startDate, Rectangle sRect)
        {
            double x = ColumnWidth / CalendarView.BaseInterval;

            int offset = (int)((ti.IndicatorDisplayTime - startDate).TotalMinutes * x);

            sRect.X += (offset - ti.Thickness - 1);
            sRect.Width = ti.Thickness;

            return (sRect);
        }
Exemple #3
0
 /// <summary>
 /// Gets the TimeIndicator Rectangle
 /// </summary>
 /// <param name="ti"></param>
 /// <returns></returns>
 internal override Rectangle GetIndicatorRect(TimeIndicator ti)
 {
     return (GetIndicatorRect(ti, ti.IndicatorDisplayTime));
 }
Exemple #4
0
        /// <summary>
        /// Gets the Indicator Back color
        /// </summary>
        /// <param name="ti"></param>
        /// <returns></returns>
        private ColorDef GetIndicatorColor(TimeIndicator ti)
        {
            ColorDef cdef = ti.IndicatorColor;

            if (cdef == null || cdef.IsEmpty == true)
                cdef = _ViewColor.GetColorDef((int)eCalendarWeekDayPart.TimeIndicator);

            return (cdef);
        }
Exemple #5
0
 /// <summary>
 /// Gets the Indicator Border color
 /// </summary>
 /// <param name="ti"></param>
 /// <returns></returns>
 private Color GetIndicatorBorder(TimeIndicator ti)
 {
     return (ti.BorderColor.IsEmpty == false ? ti.BorderColor :
         _ViewColor.GetColor((int)eCalendarWeekDayPart.TimeIndicatorBorder));
 }
Exemple #6
0
        /// <summary>
        /// Draws individual view TimeIndicator
        /// </summary>
        /// <param name="g"></param>
        /// <param name="startDate"></param>
        /// <param name="sRect"></param>
        /// <param name="ti"></param>
        private void DrawTimeIndicator(Graphics g,
            DateTime startDate, Rectangle sRect, TimeIndicator ti)
        {
            Rectangle r = GetIndicatorRect(ti, startDate, sRect);

            if (r.IntersectsWith(sRect) == true)
            {
                if (r.Width > 0)
                {
                    ColorDef cdef = GetIndicatorColor(ti);

                    if (cdef != null)
                    {
                        float angle = cdef.Angle - 90;

                        using (Brush br = _ViewColor.BrushPart(cdef, r, angle))
                        {
                            if (br is LinearGradientBrush)
                                ((LinearGradientBrush) br).WrapMode = WrapMode.TileFlipX;

                            g.FillRectangle(br, r);
                        }
                    }
                }

                Color color = GetIndicatorBorder(ti);

                if (color.IsEmpty == false)
                {
                    using (Pen pen = new Pen(color))
                        g.DrawLine(pen, r.Right, r.Top, r.Right, r.Bottom - 1);
                }
            }
        }
        /// <summary>
        /// GetIndicatorRect
        /// </summary>
        /// <param name="ti"></param>
        /// <returns></returns>
        private Rectangle GetIndicatorRect(TimeIndicator ti)
        {
            DateTime time = ti.IndicatorDisplayTime;

            int offset = (int)(time.Hour * SlotsPerHour * TimeSliceHeight +
                    (TimeSliceHeight * time.Minute) / TimeSlotDuration);

            offset -= (int)(StartSlice * TimeSliceHeight);

            Rectangle r = Bounds;

            r.Y += (offset - ti.Thickness + _VScrollPos);
            r.Height = ti.Thickness;

            return (r);
        }
 /// <summary>
 /// Gets the Indicator Border color
 /// </summary>
 /// <param name="ti"></param>
 /// <returns></returns>
 private Color GetIndicatorBorder(TimeIndicator ti)
 {
     return (ti.BorderColor.IsEmpty == false ? ti.BorderColor :
         _ViewColor.GetColor((int)eTimeRulerPart.TimeRulerIndicatorBorder));
 }
        /// <summary>
        /// Draws individual TimeIndicators
        /// </summary>
        /// <param name="g"></param>
        /// <param name="sRect"></param>
        /// <param name="ti"></param>
        private void DrawTimeIndicator(Graphics g, Rectangle sRect, TimeIndicator ti)
        {
            Rectangle r = GetIndicatorRect(ti);

            if (r.IntersectsWith(sRect) == true)
            {
                if (r.Height > 0)
                {
                    ColorDef cdef = GetIndicatorColor(ti);

                    if (cdef != null)
                    {
                        using (Brush br = _ViewColor.BrushPart(cdef, r))
                        {
                            if (br is LinearGradientBrush)
                                ((LinearGradientBrush)br).WrapMode = WrapMode.TileFlipX;

                            g.FillRectangle(br, r);
                        }
                    }
                }

                Color color = GetIndicatorBorder(ti);

                if (color.IsEmpty == false)
                {
                    using (Pen pen = new Pen(color))
                        g.DrawLine(pen, r.X + 1, r.Bottom, r.Right - 1, r.Bottom);
                }
            }
        }
Exemple #10
0
        /// <summary>
        /// Gets the TimeIndicator rectangle for the
        /// given DataTime
        /// </summary>
        /// <param name="ti"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        internal override Rectangle GetIndicatorRect(TimeIndicator ti, DateTime time)
        {
            DateTime startTime = GetTime(_DayColumns[0].Date, 0, 0);
            DateTime endTime = GetTime(_DayColumns[NumberOfColumns - 1].Date, NumberOfActiveSlices, 0);

            if (time >= startTime && time < endTime)
            {
                int offset = (int) (time.Hour * SlotsPerHour * TimeSliceHeight +
                                    (TimeSliceHeight * time.Minute) / TimeSlotDuration);

                offset -= (int) (StartSlice * TimeSliceHeight);

                Rectangle r = ViewRect;
                r.Width -= 1;

                r.Y = _DayColumns[0].Bounds.Y + offset - ti.Thickness;
                r.Height = ti.Thickness;

                return (r);
            }

            return (Rectangle.Empty);
        }