/// <summary> /// Render this object to the specified <see c_ref="Graphics"/> device. /// </summary> /// <remarks> /// This method is normally only called by the Draw method /// of the parent <see c_ref="GraphObjList"/> collection object. /// </remarks> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the /// PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see c_ref="PaneBase"/> object that is the parent or /// owner of this object. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and /// passed down by the parent <see c_ref="GraphPane"/> object using the /// <see c_ref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust /// font sizes, etc. according to the actual size of the graph. /// </param> override public void Draw(Graphics g, PaneBase pane, float scaleFactor) { // Convert the arrow coordinates from the user coordinate system // to the screen coordinate system RectangleF pixRect = Location.TransformRect(pane); // Clip the rect to just outside the PaneRect so we don't end up with wild coordinates. RectangleF tmpRect = pane.Rect; tmpRect.Inflate(20, 20); pixRect.Intersect(tmpRect); if (Math.Abs(pixRect.Left) < 100000 && Math.Abs(pixRect.Top) < 100000 && Math.Abs(pixRect.Right) < 100000 && Math.Abs(pixRect.Bottom) < 100000) { // If the box is to be filled, fill it _fill.Draw(g, pixRect); // Draw the border around the box if required _border.Draw(g, pane, scaleFactor, pixRect); } }
/// <summary> /// Render this object to the specified <see c_ref="Graphics"/> device. /// </summary> /// <remarks> /// This method is normally only called by the Draw method /// of the parent <see c_ref="GraphObjList"/> collection object. /// </remarks> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the /// PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see c_ref="PaneBase"/> object that is the parent or /// owner of this object. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and /// passed down by the parent <see c_ref="GraphPane"/> object using the /// <see c_ref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust /// font sizes, etc. according to the actual size of the graph. /// </param> override public void Draw(Graphics g, PaneBase pane, float scaleFactor) { // Convert the arrow coordinates from the user coordinate system // to the screen coordinate system RectangleF pixRect = Location.TransformRect(pane); if (Math.Abs(pixRect.Left) < 100000 && Math.Abs(pixRect.Top) < 100000 && Math.Abs(pixRect.Right) < 100000 && Math.Abs(pixRect.Bottom) < 100000) { if (_fill.IsVisible) { using (Brush brush = _fill.MakeBrush(pixRect)) g.FillEllipse(brush, pixRect); } if (_border.IsVisible) { using (Pen pen = _border.GetPen(pane, scaleFactor)) g.DrawEllipse(pen, pixRect); } } }