コード例 #1
0
        /// <summary>
        /// Replaces existing <see cref="Lines"/> with the specified <see cref="ImageMarkerLine"/>s.
        /// </summary>
        /// <param name="lines">The new <see cref="ImageMarkerLine"/>s</param>
        public void UpdateLines(List <ImageMarkerLine> lines)
        {
            if (Lines.Count > 0)
            {
                ImageMarkerLine[] tempLines = new ImageMarkerLine[Lines.Count];
                Lines.CopyTo(tempLines);
                Lines.Clear();

                foreach (ImageMarkerLine imageMarkerLine in tempLines)
                {
                    Rectangle rectangle = GetImageMarkerLineRectangle(imageMarkerLine);
                    rectangle.Inflate(1, 1);
                    Invalidate(rectangle);
                }
            }

            if (lines.Count > 0)
            {
                Lines.AddRange(lines);

                foreach (ImageMarkerLine imageMarkerLine in Lines)
                {
                    Rectangle rectangle = GetImageMarkerLineRectangle(imageMarkerLine);
                    rectangle.Inflate(1, 1);
                    Invalidate(rectangle);
                }
            }
        }
コード例 #2
0
        private ImageMarkerLine GetImageMarkerLine(MarginBarMarkerBase marker)
        {
            Rectangle markerRectangle = GetMarkerRectangle(marker);

            ImageMarkerLine imageMarkerLine = new ImageMarkerLine
            {
                Color       = ImageMarkerLineColor,
                DashStyle   = ImageMarkerDashStyle,
                Orientation = Orientation.Vertical,
                Padding     = new Padding(2),
                Value       = markerRectangle.Left + (markerRectangle.Width / 2)
            };

            return(imageMarkerLine);
        }
コード例 #3
0
 private float GetSecondaryValue(ImageMarkerLine imageMarkerLine)
 {
     return(imageMarkerLine.Orientation == Orientation.Horizontal ? Width : Height);
 }
コード例 #4
0
 private Rectangle GetImageMarkerLineRectangle(ImageMarkerLine imageMarkerLine)
 {
     return(imageMarkerLine.GetRectangle(GetSecondaryValue(imageMarkerLine)));
 }
コード例 #5
0
 /// <summary>
 /// Replaces existing <see cref="Lines"/> with the specified <see cref="ImageMarkerLine"/>.
 /// </summary>
 /// <param name="line">The new <see cref="ImageMarkerLine"/></param>
 public void UpdateLines(ImageMarkerLine line)
 {
     UpdateLines(new List <ImageMarkerLine> {
         line
     });
 }