Example #1
0
 private void c1LinearGauge1_ItemStateChanged(object sender, C1.Win.C1Gauge.ItemEventArgs e)
 {
     if (e.Item is C1GaugePointer)
     {
         C1GaugePointer po = e.Item as C1GaugePointer;
         c1Gauge1.BeginUpdate();
         if (e.ItemHot || e.ItemPressed)
         {
             po.Filling.CommonFillingName = "hotPointer";
         }
         else
         {
             po.Filling.CommonFillingName = "normalPointer";
         }
         c1Gauge1.EndUpdate(200);
     }
     else if (e.Item is C1GaugeSingleMark)
     {
         C1GaugeSingleMark  sm = e.Item as C1GaugeSingleMark;
         C1GaugeSingleLabel sl = null;
         if (sm.Name == "minusButton")
         {
             sl = (C1GaugeSingleLabel)e.Gauge.Decorators["minusLabel"];
         }
         else if (sm.Name == "plusButton")
         {
             sl = (C1GaugeSingleLabel)e.Gauge.Decorators["plusLabel"];
         }
         else
         {
             return;
         }
         c1Gauge1.BeginUpdate();
         if (e.ItemPressed)
         {
             sm.Gradient.CommonGradientName = "pressed";
         }
         else
         {
             sm.Gradient.CommonGradientName = "normal";
         }
         sl.Color = Color.SeaGreen;
         if (e.ItemPressed)
         {
             sm.Filling.CommonFillingName = "pressedButton";
         }
         else if (e.ItemHot)
         {
             sm.Filling.CommonFillingName = "hotButton";
         }
         else
         {
             sm.Filling.CommonFillingName = "normalButton";
             sl.Color = Color.LightCoral;
         }
         c1Gauge1.EndUpdate(200);
     }
 }
Example #2
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();
        }
Example #3
0
 private void c1LinearGauge1_ItemStateChanged(object sender, ItemEventArgs e)
 {
     if (e.Item is C1GaugePointer)
     {
         C1GaugePointer po = e.Item as C1GaugePointer;
         c1Gauge1.BeginUpdate();
         if (e.ItemHot || e.ItemPressed)
         {
             po.Filling.CommonFillingName = "hotPointer";
         }
         else
         {
             po.Filling.CommonFillingName = "normalPointer";
         }
         c1Gauge1.EndUpdate(200);
     }
     else if (e.Item is C1GaugeSingleMark)
     {
         C1GaugeSingleMark sm = e.Item as C1GaugeSingleMark;
         if (sm.Name == "minusButton" || sm.Name == "plusButton")
         {
             c1Gauge1.BeginUpdate();
             if (e.ItemPressed)
             {
                 sm.Filling.CommonFillingName = "pressedButton";
             }
             else if (e.ItemHot)
             {
                 sm.Filling.CommonFillingName = "hotButton";
             }
             else
             {
                 sm.Filling.CommonFillingName = "normalButton";
             }
             if (e.ItemPressed)
             {
                 sm.Gradient.CommonGradientName = "pressed";
             }
             else
             {
                 sm.Gradient.CommonGradientName = "normal";
             }
             c1Gauge1.EndUpdate(150);
         }
     }
 }
Example #4
0
        private void FillDecorators()
        {
            c1Gauge1.BeginUpdate();

            CommonColorMap colorMap = new CommonColorMap();

            colorMap.Name = "green";
            colorMap.ValueColorFalloff = C1GaugeValueColorFalloff.None;
            colorMap.ValueColors.Add(new C1GaugeValueColor(0.0, Color.LimeGreen, 1.0));
            colorMap.ValueColors.Add(new C1GaugeValueColor(double.NaN, 100, Color.DimGray, 1.0));
            c1LinearGauge1.ColorMaps.Add(colorMap);

            colorMap      = new CommonColorMap();
            colorMap.Name = "yellow";
            colorMap.ValueColorFalloff = C1GaugeValueColorFalloff.None;
            colorMap.ValueColors.Add(new C1GaugeValueColor(0.0, Color.Yellow, 1.0));
            colorMap.ValueColors.Add(new C1GaugeValueColor(double.NaN, 100, Color.DimGray, 1.0));
            c1LinearGauge1.ColorMaps.Add(colorMap);

            colorMap      = new CommonColorMap();
            colorMap.Name = "red";
            colorMap.ValueColorFalloff = C1GaugeValueColorFalloff.None;
            colorMap.ValueColors.Add(new C1GaugeValueColor(0.0, Color.FromArgb(255, 64, 64), 1.0));
            colorMap.ValueColors.Add(new C1GaugeValueColor(double.NaN, 100, Color.DimGray, 1.0));
            c1LinearGauge1.ColorMaps.Add(colorMap);

            for (int i = 0; i < 100; i++)
            {
                C1GaugeSingleMark mark = new C1GaugeSingleMark();
                mark.Border.LineStyle = C1GaugeBorderStyle.None;
                mark.Shape            = C1GaugeMarkShape.Round;
                mark.Width            = 2;
                double dl = i * 0.035;
                mark.Length = 6 + dl * dl * dl;
                if (i < 60)
                {
                    mark.ColorMapName = "green";
                }
                else if (i < 85)
                {
                    mark.ColorMapName = "yellow";
                }
                else
                {
                    mark.ColorMapName = "red";
                }
                mark.Value = i / 100.0;

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

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

                c1LinearGauge1.Decorators.Add(mark);
            }
            c1Gauge1.EndUpdate();
        }