Exemplo n.º 1
0
        /// <summary>
        /// Draws the web.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <param name="item">The item.</param>
        /// <param name="point1">The point1.</param>
        /// <param name="points">The points.</param>
        /// <param name="points1">The points1.</param>
        /// <param name="enumerator">The enumerator.</param>
        /// <param name="enumerator1">The enumerator1.</param>
        /// <param name="graphics">The graphics.</param>
        /// <param name="linearGradientBrush">The linear gradient brush.</param>
        private void DrawWeb(
            Point point,
            Point item,
            Point point1,
            List <Point> points,
            List <Point> points1,
            IEnumerator <ZeroitMetroWebChartPoint> enumerator,
            IEnumerator <ZeroitMetroWebChartPoint> enumerator1,
            Graphics graphics,
            Brush linearGradientBrush
            )
        {
            if (this.Points.Count >= 3)
            {
                int num = 0;

                enumerator = this.Points.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    ZeroitMetroWebChartPoint current = enumerator.Current;
                    num = checked (num + checked ((int)Math.Round(360 / (double)this.Points.Count)));
                    Point point2 = new Point(checked ((int)Math.Round((double)point1.X + (double)(checked (point1.X - this._PointSize)) * Math.Cos((double)num * 3.14159265358979 / 180))), checked ((int)Math.Round((double)point1.Y + (double)(checked (point1.X - this._PointSize)) * Math.Sin((double)num * 3.14159265358979 / 180))));
                    points1.Add(point2);
                    points.Add(this.GetPointOnLine(point2, point1, checked (100 - current.Value)));
                }

                if (this._DrawInnerStructure)
                {
                    this.DrawInnerStructureGrid(graphics, point1, points1.ToArray(), this._InnerStructureStages);
                }
                using (Pen pen = new Pen(this._WebBorderColor, (float)this._WebBorderWidth))
                {
                    if (!this._WebBorderIsGradient)
                    {
                        if (!BezierCurve)
                        {
                            graphics.DrawPolygon(pen, points.ToArray());
                        }
                        else
                        {
                            graphics.DrawClosedCurve(pen, points.ToArray());
                        }
                    }
                    else
                    {
                        int count = checked (points.Count - 1);
                        for (int i = 0; i <= count; i = checked (i + 1))
                        {
                            using (LinearGradientBrush linearGradientBrush1 = new LinearGradientBrush(points[i], (i == checked (points.Count - 1) ? points[0] : points[checked (i + 1)]), this.Points[i].Color, ((i == checked (points.Count - 1) ? this.Points[0] : this.Points[checked (i + 1)])).Color))
                            {
                                using (Pen pen1 = new Pen(linearGradientBrush1, (float)this._WebBorderWidth))
                                {
                                    graphics.DrawLine(pen1, points[i], (i == checked (points.Count - 1) ? points[0] : points[checked (i + 1)]));
                                }
                            }
                        }
                    }
                    pen.Color = this._OuterStructureBorder;
                    if (!BezierCurve)
                    {
                        graphics.DrawPolygon(pen, points1.ToArray());
                    }
                    else
                    {
                        graphics.DrawClosedCurve(pen, points1.ToArray());
                    }
                }
                switch (this._FillMode)
                {
                case ZeroitMetroWebChart.FillModes.Gradient:
                {
                    point = new Point(checked ((int)Math.Round((double)this._ChartWidth / 2)), this._ChartWidth);
                    item  = new Point(checked ((int)Math.Round((double)this._ChartWidth / 2)), 0);
                    linearGradientBrush = new LinearGradientBrush(point, item, this._FillColor, this._FillSecondColor);
                    break;
                }

                case ZeroitMetroWebChart.FillModes.MultiGradient:
                {
                    List <Color> colors = new List <Color>();


                    enumerator1 = this.Points.GetEnumerator();
                    while (enumerator1.MoveNext())
                    {
                        colors.Add(enumerator1.Current.Color);
                    }

                    PathGradientBrush pathGradientBrush = new PathGradientBrush(points.ToArray())
                    {
                        CenterColor    = this._FillColor,
                        SurroundColors = colors.ToArray()
                    };

                    linearGradientBrush = pathGradientBrush;
                    break;
                }

                case ZeroitMetroWebChart.FillModes.Hatch:
                {
                    linearGradientBrush = new HatchBrush(this._HatchStyle, this._FillColor, this._FillSecondColor);
                    break;
                }

                default:
                {
                    linearGradientBrush = new SolidBrush(this._FillColor);
                    break;
                }
                }

                if (!BezierCurve)
                {
                    graphics.FillPolygon(linearGradientBrush, points.ToArray());
                }
                else
                {
                    graphics.FillClosedCurve(linearGradientBrush, points.ToArray());
                }

                linearGradientBrush.Dispose();
                int count1 = checked (points1.Count - 1);
                for (int j = 0; j <= count1; j = checked (j + 1))
                {
                    item = points1[j];
                    int x = checked (item.X - checked ((int)Math.Round((double)this._PointSize / 2)));
                    point = points1[j];
                    Rectangle rectangle1 = new Rectangle(x, checked (point.Y - checked ((int)Math.Round((double)this._PointSize / 2))), this._PointSize, this._PointSize);
                    using (SolidBrush solidBrush = new SolidBrush(this._CornerFillColor))
                    {
                        using (Pen pen2 = new Pen(this._CornerBorderColor))
                        {
                            if (this._CornerShape != ZeroitMetroWebChart.CornerShapes.Rectangular)
                            {
                                graphics.DrawEllipse(pen2, rectangle1);
                                graphics.FillEllipse(solidBrush, rectangle1);
                            }
                            else
                            {
                                graphics.DrawRectangle(pen2, rectangle1);
                                graphics.FillRectangle(solidBrush, rectangle1);
                            }
                        }
                    }
                    this._OuterPoints.Add(rectangle1);
                }
                if (this._DrawWebPoints)
                {
                    int num1 = checked (points.Count - 1);
                    for (int k = 0; k <= num1; k = checked (k + 1))
                    {
                        using (SolidBrush solidBrush1 = new SolidBrush(this.Points[k].Color))
                        {
                            item = points[k];
                            int x1 = checked (item.X - checked ((int)Math.Round((double)this._WebPointWidth / 2)));
                            point = points[k];
                            graphics.FillEllipse(solidBrush1, x1, checked (point.Y - checked ((int)Math.Round((double)this._WebPointWidth / 2))), this._WebPointWidth, this._WebPointWidth);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ZeroitMetroWebChartPointCollectionEventArgs"/> class.
 /// </summary>
 /// <param name="item">The item.</param>
 public ZeroitMetroWebChartPointCollectionEventArgs(ZeroitMetroWebChartPoint item)
 {
     this._item = item;
 }