Exemplo n.º 1
0
        internal Pen GetPen(GraphPane pane, float scaleFactor)
        {
            Pen pen = new Pen(_color,
                              pane.ScaledPenWidth(_penWidth, scaleFactor));

            if (_dashOff > 1e-10 && _dashOn > 1e-10)
            {
                pen.DashStyle = DashStyle.Custom;
                float[] pattern = new float[2];
                pattern[0]      = _dashOn;
                pattern[1]      = _dashOff;
                pen.DashPattern = pattern;
            }

            return(pen);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Render the label for this <see cref="GasGaugeNeedle"/>.
        /// </summary>
        /// <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 graphic device object to be drawn into. This is normally e.Graphics from the
        /// PaintEventArgs argument to the Paint() method.
        /// </param>
        /// <param name="rect">Bounding rectangle for this <see cref="GasGaugeNeedle"/>.</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 DrawLegendKey(Graphics g, GraphPane pane, RectangleF rect, float scaleFactor)
        {
            if (!_isVisible)
            {
                return;
            }

            float yMid = rect.Top + rect.Height / 2.0F;

            Pen pen = new Pen(NeedleColor, pane.ScaledPenWidth(NeedleWidth / 2, scaleFactor));

            pen.StartCap  = LineCap.Round;
            pen.EndCap    = LineCap.ArrowAnchor;
            pen.DashStyle = DashStyle.Solid;
            g.DrawLine(pen, rect.Left, yMid, rect.Right, yMid);
        }
Exemplo n.º 3
0
 internal Pen GetPen(GraphPane pane, float scaleFactor)
 {
     return(new Pen(_color, pane.ScaledPenWidth(_penWidth, scaleFactor)));
 }