예제 #1
0
        /// <summary>
        /// Render text to the specified <see cref="Graphics"/> device
        /// by calling the Draw method of each <see cref="GraphItem"/> object in
        /// the collection.
        /// </summary>
        /// <remarks>This method is normally only called by the Draw method
        /// of the parent <see cref="GraphPane"/> 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 cref="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 cref="GraphPane"/> object using the
        /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust
        /// font sizes, etc. according to the actual size of the graph.
        /// </param>
        /// <param name="zOrder">A <see cref="ZOrder"/> enumeration that controls
        /// the placement of this <see cref="GraphItem"/> relative to other
        /// graphic objects.  The order of <see cref="GraphItem"/>'s with the
        /// same <see cref="ZOrder"/> value is control by their order in
        /// this <see cref="GraphItemList"/>.</param>
        public void Draw(Graphics g, PaneBase pane, float scaleFactor,
                         ZOrder zOrder)
        {
            // Draw the items in reverse order, so the last items in the
            // list appear behind the first items (consistent with
            // CurveList)
            for (int i = this.Count - 1; i >= 0; i--)
            {
                GraphItem item = this[i];
                if (item.ZOrder == zOrder && item.IsVisible)
                {
                    Region region = null;
                    if (item.IsClippedToAxisRect && pane is GraphPane)
                    {
                        region = g.Clip.Clone();
                        g.SetClip(((GraphPane)pane).AxisRect);
                    }

                    item.Draw(g, pane, scaleFactor);

                    if (item.IsClippedToAxisRect && pane is GraphPane)
                    {
                        g.Clip = region;
                    }
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Render text to the specified <see cref="Graphics"/> device
 /// by calling the Draw method of each <see cref="GraphItem"/> object in
 /// the collection.
 /// </summary>
 /// <remarks>This method is normally only called by the Draw method
 /// of the parent <see cref="GraphPane"/> 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 cref="GraphPane"/> 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 cref="GraphPane"/> object using the
 /// <see cref="GraphPane.CalcScaleFactor"/> method, and is used to proportionally adjust
 /// font sizes, etc. according to the actual size of the graph.
 /// </param>
 /// <param name="zOrder">A <see cref="ZOrder"/> enumeration that controls
 /// the placement of this <see cref="GraphItem"/> relative to other
 /// graphic objects.  The order of <see cref="GraphItem"/>'s with the
 /// same <see cref="ZOrder"/> value is control by their order in
 /// this <see cref="GraphItemList"/>.</param>
 public void Draw(Graphics g, GraphPane pane, double scaleFactor,
                  ZOrder zOrder)
 {
     // Draw the items in reverse order, so the last items in the
     // list appear behind the first items (consistent with
     // CurveList)
     for (int i = this.Count - 1; i >= 0; i--)
     {
         GraphItem item = this[i];
         if (item.ZOrder == zOrder)
         {
             item.Draw(g, pane, scaleFactor);
         }
     }
 }