Esempio n. 1
0
        /// <summary>
        /// Add a <see cref="PointPair"/> object to the collection at the end of the list.
        /// </summary>
        /// <param name="point">The <see cref="PointPair"/> object to be added</param>
        public void Add(PointPair point)
        {
//			throw new ArgumentException( "Error: Only the StockPt type can be added to StockPointList" +
//				".  An ordinary PointPair is not allowed" );
            base.Add(new StockPt(point));
        }
Esempio n. 2
0
        /// <summary>
        /// Create a fill brush using current properties.  This method will construct a brush based on the
        /// settings of <see cref="Fill.Type"/>, <see cref="Fill.Color"/>
        /// and <see cref="Fill.Brush"/>.  If
        /// <see cref="Fill.Type"/> is set to <see cref="FillType.Brush"/> and
        /// <see cref="Fill.Brush"/>
        /// is null, then a <see cref="LinearGradientBrush"/> will be created between the colors of
        /// <see cref="System.Drawing.Color.White"/> and <see cref="Fill.Color"/>.
        /// </summary>
        /// <param name="rect">A rectangle that bounds the object to be filled.  This determines
        /// the start and end of the gradient fill.</param>
        /// <param name="dataValue">The data value to be used for a value-based
        /// color gradient.  This is only applicable for <see cref="FillType.GradientByX"/>,
        /// <see cref="FillType.GradientByY"/> or <see cref="FillType.GradientByZ"/>.</param>
        /// <returns>A <see cref="System.Drawing.Brush"/> class representing the fill brush</returns>
        public Brush MakeBrush(RectangleF rect, PointPair dataValue)
        {
            // get a brush
            if (this.IsVisible && (!_color.IsEmpty || _brush != null))
            {
                if (rect.Height < 1.0F)
                {
                    rect.Height = 1.0F;
                }
                if (rect.Width < 1.0F)
                {
                    rect.Width = 1.0F;
                }

                //Brush	brush;
                if (_type == FillType.Brush)
                {
                    return(ScaleBrush(rect, _brush, _isScaled));
                }
                else if (IsGradientValueType)
                {
                    if (dataValue != null)
                    {
                        if (!_secondaryValueGradientColor.IsEmpty)
                        {
                            // Go ahead and create a new Fill so we can do all the scaling, etc.,
                            // that is associated with a gradient
                            Fill tmpFill = new Fill(_secondaryValueGradientColor,
                                                    GetGradientColor(dataValue), _angle);
                            return(tmpFill.MakeBrush(rect));
                        }
                        else
                        {
                            return(new SolidBrush(GetGradientColor(dataValue)));
                        }
                    }
                    else if (_rangeDefault != double.MaxValue)
                    {
                        if (!_secondaryValueGradientColor.IsEmpty)
                        {
                            // Go ahead and create a new Fill so we can do all the scaling, etc.,
                            // that is associated with a gradient
                            Fill tmpFill = new Fill(_secondaryValueGradientColor,
                                                    GetGradientColor(_rangeDefault), _angle);
                            return(tmpFill.MakeBrush(rect));
                        }
                        else
                        {
                            return(new SolidBrush(GetGradientColor(_rangeDefault)));
                        }
                    }
                    else
                    {
                        return(ScaleBrush(rect, _brush, true));
                    }
                }
                else
                {
                    return(new SolidBrush(_color));
                }
            }

            // Always return a suitable default
            return(new SolidBrush(Color.White));
        }