/// ------------------------------------------------------------------------------------
        private void DrawBackground(PaintEventArgs e, Rectangle rc)
        {
            var rcSegmentedArea = GetFullRectangleForTimeRange(new TimeRange(TimeSpan.Zero,
                                                                             SegmentBoundaries.LastOrDefault()));

            rcSegmentedArea.Intersect(rc);
            if (rcSegmentedArea.Width > 0)
            {
                using (var brush = new SolidBrush(SegmentedBackgroundColor))
                    e.Graphics.FillRectangle(brush, rcSegmentedArea);
            }

            FillIgnoredSegments(e, Color.White);

            var x = (!SegmentBoundaries.Any()) ? 0 : ConvertTimeToXCoordinate(SegmentBoundaries.Last()) + 1;

            if (x > rc.Right)
            {
                return;
            }

            if (x > rc.X)
            {
                rc.Width -= (x - rc.X);
                rc.X      = x;
            }
            using (var brush = new SolidBrush(UnsegmentedBackgroundColor))
                e.Graphics.FillRectangle(brush, rc);
        }
Exemplo n.º 2
0
 /// ------------------------------------------------------------------------------------
 public void SetSelectedBoundary(TimeSpan boundary)
 {
     if (boundary == TimeSpan.Zero || SegmentBoundaries.Any(b => b == boundary))
     {
         MyPainter.SetSelectedBoundary(boundary);
         EnsureTimeIsVisible(boundary, new TimeRange(boundary, boundary), false, false);
     }
 }