Exemple #1
0
        /// <summary>
        /// Get path of graph object which is used for PointInBox
        /// </summary>
        /// <param name="pane"></param>
        /// <returns></returns>
        virtual public GraphicsPath MakePath(PaneBase pane)
        {
            GraphicsPath path = new GraphicsPath();

            // transform the x,y location from the user-defined
            // coordinate frame to the screen pixel location
            RectangleF pixRect = _location.TransformRect(pane);

            path.AddRectangle(pixRect);

            return(path);
        }
Exemple #2
0
        /// <summary>
        /// Render this object to the specified <see cref="Graphics"/> device.
        /// </summary>
        /// <remarks>
        /// This method is normally only called by the Draw method
        /// of the parent <see cref="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 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>
        public override void Draw(Graphics g, PaneBase pane, float scaleFactor)
        {
            // Convert the arrow coordinates from the user coordinate system
            // to the screen coordinate system
            var 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)
            {
                return;
            }
            if (_fill.IsVisible)
            {
                using (var brush = _fill.MakeBrush(pixRect)) g.FillEllipse(brush, pixRect);
            }

            if (_border.IsVisible)
            {
                using (var pen = _border.GetPen(pane, scaleFactor)) g.DrawEllipse(pen, pixRect);
            }
        }
Exemple #3
0
        /// <summary>
        /// Render this object to the specified <see cref="Graphics"/> device.
        /// </summary>
        /// <remarks>
        /// This method is normally only called by the Draw method
        /// of the parent <see cref="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 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>
        public override void Draw(Graphics g, PaneBase pane, float scaleFactor)
        {
            // Convert the arrow coordinates from the user coordinate system
            // to the screen coordinate system
            var pixRect = Location.TransformRect(pane);

            // Clip the rect to just outside the PaneRect so we don't end up with wild coordinates.
            var 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)
            {
                return;
            }
            // 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);
        }
Exemple #4
0
        /// <summary>
        /// Render this object to the specified <see cref="Graphics"/> device.
        /// </summary>
        /// <remarks>
        /// This method is normally only called by the Draw method
        /// of the parent <see cref="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 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>
        public override 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.MakePen(pane.IsPenWidthScaled, scaleFactor))
                        g.DrawEllipse(pen, pixRect);
                }
            }
        }