Beispiel #1
0
        private void FillDecorators()
        {
            c1Gauge1.BeginUpdate();

            CommonShape commonShape = new CommonShape();

            commonShape.Name          = "my arrow";
            commonShape.StartWidth    = 2.5;
            commonShape.EndAngle      = 60.0;
            commonShape.EndWidth      = 2.5;
            commonShape.EndSwellWidth = 1;
            c1Gauge1.CommonShapes.Add(commonShape);

            CommonColorMap colorMap = new CommonColorMap();

            colorMap.Name = "my colors";
            colorMap.ValueColorFalloff = C1GaugeValueColorFalloff.None;
            colorMap.ValueColors.Add(new C1GaugeValueColor(0.0, Color.SteelBlue, 1.0));
            colorMap.ValueColors.Add(new C1GaugeValueColor(double.NaN, 2, Color.Transparent, 1.0));
            colorMap.ValueColors.Add(new C1GaugeValueColor(double.NaN, 1, Color.SteelBlue, 1.0));
            colorMap.ValueColors.Add(new C1GaugeValueColor(double.NaN, 0, Color.Transparent, 1.0));
            c1LinearGauge1.ColorMaps.Add(colorMap);

            for (int i = 0; i <= 100; i += 2)
            {
                C1GaugeSingleMark mark = new C1GaugeSingleMark();
                mark.Border.Color                = Color.LightSteelBlue;
                mark.Filling.BrushType           = C1GaugeBrushType.Gradient;
                mark.Filling.Color2              = Color.LightSteelBlue;
                mark.Gradient.Direction          = C1GaugeGradientDirection.RadialOuter;
                mark.CustomShape.CommonShapeName = "my arrow";
                mark.Length       = 6;
                mark.Width        = 2.5;
                mark.ColorMapName = "my colors";
                mark.Value        = i;

                double x, y;
                GetXY(i, out x, out y);
                mark.Position = x * 0.01 + 0.5;
                mark.Location = y + 50;

                double x1, y1;
                GetXY(i + 0.01, out x1, out y1);
                double l     = Math.Sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));
                double alpha = Math.Asin((y1 - y) / l);
                if (x1 < x)
                {
                    alpha = Math.PI - alpha;
                }
                mark.ShapeAngle = -alpha * 180.0 / Math.PI + 90.0;

                c1LinearGauge1.Decorators.Add(mark);
            }
            c1Gauge1.EndUpdate();
        }
        static void Main(string[] args)
        {
            Circle circle = new Circle(10);

            Console.WriteLine(circle.CalcSquare().ToString());

            Triangle triangle = new Triangle(8, 6, 10);

            Console.WriteLine(triangle.CalcSquare().ToString());

            CommonShape common = new CommonShape();

            common.Dimentions = new double[] { 10 };
            Console.WriteLine(common.CalcSquare().ToString());

            common.Dimentions = new double[] { 8, 6, 10 };
            Console.WriteLine(common.CalcSquare().ToString());
        }