protected virtual void DrawGraph(RangeControlPaintEventArgs e, Rectangle contentBounds) { e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; int start = Math.Max(0, (int)(e.RangeControl.VisibleRangeStartPosition * BarCount) - 2); int end = Math.Min(Data.Length, start + ((int)(e.RangeControl.VisibleRangeWidth * BarCount) + 4)); Point?prevPoint = null; using (Pen pen = new Pen(Color.Blue, 1)) { for (int i = start; i < end; i++) { int y = contentBounds.Y + contentBounds.Height - (int)((double)(Data[i] - MinValue) / (MaxValue - MinValue) * contentBounds.Height); int x = e.CalcX((double)i / BarCount); if (prevPoint.HasValue) { e.Cache.DrawLine(new Point(prevPoint.Value.X, prevPoint.Value.Y), new Point(x, y), Color.Blue, 1); } prevPoint = new Point(x, y); } } e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default; }