/// <summary> /// Occurs during drawing. /// </summary> /// <param name="g">The graphics object used for drawing.</param> /// <param name="clip">The clip rectangle.</param> protected virtual void OnDraw(Graphics g, Rectangle clip) { if (Height <= 1 || Width <= 1) { return; } // Draw text first because the text is used to auto-fit the remaining graph. _graph.Draw(g, clip); if (BorderStyle == BorderStyle.Fixed3D) { g.DrawLine(Pens.White, 0, Height - 1, Width - 1, Height - 1); g.DrawLine(Pens.White, Width - 1, 0, Width - 1, Height - 1); g.DrawLine(Pens.Gray, 0, 0, 0, Height - 1); g.DrawLine(Pens.Gray, 0, 0, Width - 1, 0); } if (BorderStyle == BorderStyle.FixedSingle) { g.DrawRectangle(Pens.Black, 0, 0, Width - 1, Height - 1); } if (Breaks == null) { return; } Rectangle gb = _graph.GetGraphBounds(); foreach (BreakSlider slider in Breaks) { slider.Setup(gb, _graph.Minimum, _graph.Maximum); if (slider.Bounds.IntersectsWith(clip)) { slider.Draw(g); } } }