/// <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); } } }
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); }
private float GetSecondaryValue(ImageMarkerLine imageMarkerLine) { return(imageMarkerLine.Orientation == Orientation.Horizontal ? Width : Height); }
private Rectangle GetImageMarkerLineRectangle(ImageMarkerLine imageMarkerLine) { return(imageMarkerLine.GetRectangle(GetSecondaryValue(imageMarkerLine))); }
/// <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 }); }