public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
        {
            PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(value, false);
            CircularPointer circularPointer         = (CircularPointer)value;
            PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(null);

            for (int i = 0; i < properties.Count; i++)
            {
                if (properties[i].IsBrowsable)
                {
                    if (circularPointer.CapStyle != 0 && (properties[i].Name == "CapFillGradientType" || properties[i].Name == "CapFillGradientEndColor" || properties[i].Name == "CapFillHatchStyle"))
                    {
                        propertyDescriptorCollection.Add(TypeDescriptor.CreateProperty(value.GetType(), properties[i], new ReadOnlyAttribute(true)));
                    }
                    else if (circularPointer.Type == CircularPointerType.Needle && (properties[i].Name == "MarkerLength" || properties[i].Name == "MarkerStyle" || properties[i].Name == "BarStart"))
                    {
                        propertyDescriptorCollection.Add(TypeDescriptor.CreateProperty(value.GetType(), properties[i], new ReadOnlyAttribute(true)));
                    }
                    else if (circularPointer.Type == CircularPointerType.Marker && (properties[i].Name == "BarStart" || properties[i].Name == "NeedleStyle" || properties[i].Name.StartsWith("Cap", StringComparison.Ordinal)))
                    {
                        propertyDescriptorCollection.Add(TypeDescriptor.CreateProperty(value.GetType(), properties[i], new ReadOnlyAttribute(true), new EditorAttribute(typeof(NullUIEditor), typeof(UITypeEditor))));
                    }
                    else if (circularPointer.Type == CircularPointerType.Bar && (properties[i].Name == "MarkerLength" || properties[i].Name == "MarkerStyle" || properties[i].Name == "NeedleStyle" || properties[i].Name.StartsWith("Cap", StringComparison.Ordinal)))
                    {
                        propertyDescriptorCollection.Add(TypeDescriptor.CreateProperty(value.GetType(), properties[i], new ReadOnlyAttribute(true), new EditorAttribute(typeof(NullUIEditor), typeof(UITypeEditor))));
                    }
                    else
                    {
                        propertyDescriptorCollection.Add(properties[i]);
                    }
                }
            }
            return(propertyDescriptorCollection);
        }
예제 #2
0
        public CircularPointer Add(string name)
        {
            CircularPointer circularPointer = new CircularPointer();

            circularPointer.Name = name;
            this.Add(circularPointer);
            return(circularPointer);
        }
예제 #3
0
        private void circularGauge1_Loaded(object sender, RoutedEventArgs e)
        {
            Double           sum  = 0;
            MyDataCollection coll = this.FindResource("SeriesData1") as MyDataCollection;
            int i = 1;

            grid.Model[i, 1].CellValue           = "Year";
            grid.Model[i, 1].HorizontalAlignment = HorizontalAlignment.Center;
            grid.Model[i, 1].Background          = Brushes.Pink;
            grid.Model[i, 1].Font.FontWeight     = FontWeights.Bold;
            grid.Model[i, 2].CellValue           = "Revenue of the Year($ 1000)";
            grid.Model[i, 2].HorizontalAlignment = HorizontalAlignment.Center;
            grid.Model[i, 2].Background          = Brushes.Pink;
            grid.Model[i, 2].Font.FontWeight     = FontWeights.Bold;

            i++;
            if (coll != null)
            {
                foreach (MyData d in coll)
                {
                    sum += d.Y1;
                    grid.Model[i, 1].CellValue           = d.Year;
                    grid.Model[i, 1].HorizontalAlignment = HorizontalAlignment.Center;
                    grid.Model[i, 1].Background          = Brushes.Pink;
                    grid.Model[i, 1].Font.FontWeight     = FontWeights.Bold;

                    grid.Model[i, 2].CellValue           = "$" + d.Y1;
                    grid.Model[i, 2].HorizontalAlignment = HorizontalAlignment.Center;
                    grid.Model[i, 2].Background          = Brushes.Pink;
                    grid.Model[i, 2].Font.FontWeight     = FontWeights.Bold;

                    i++;
                }
            }
            grid.Model[i, 1].CellValue           = "Gauge indicating Average sales during the year 2003-2007";
            grid.Model[i, 1].HorizontalAlignment = HorizontalAlignment.Center;
            grid.Model[i, 1].Font.FontWeight     = FontWeights.Bold;

            CircularGauge cg = (sender as UserControl).Content as CircularGauge;

            _circulargauge = cg;
            CircularScale cs = cg.FindName("m_scale") as CircularScale;

            if (cs != null)
            {
                _circularpointer     = cs.Pointers[0];
                cs.Pointers[0].Value = sum / 5;
            }

            CircularPointer cp = cg.FindName("pointer1") as CircularPointer;

            if (cp != null)
            {
                cp.ValueChanged += new PropertyChangedCallback(cp_ValueChanged);
            }
        }
예제 #4
0
 public int IndexOf(CircularPointer value)
 {
     return(base.List.IndexOf(value));
 }
예제 #5
0
 public void Insert(int index, CircularPointer value)
 {
     base.List.Insert(index, value);
 }
예제 #6
0
 public bool Contains(CircularPointer value)
 {
     return(base.List.Contains(value));
 }
예제 #7
0
 public void Remove(CircularPointer value)
 {
     base.List.Remove(value);
 }
예제 #8
0
 public int Add(CircularPointer value)
 {
     return(base.List.Add(value));
 }
예제 #9
0
        private bool bInitAmpereMeter()
        {
            bool bRes=false;
            Debug.WriteLine("++Form1::bInitAmpereMeter()");
            // digital Amperemeter
            NumericalFrame nfrm7Seg4IndFrame = new NumericalFrame(new Rectangle(10, 10, 200, 80));
            this.DigitalCurrentBaseUI.Frame.Add(nfrm7Seg4IndFrame); // DigitalCurrentBaseUI.Frame[0] - 7-segment indicator
            nfrm7Seg4IndFrame.BackRenderer.CenterColor = Color.Black;
            nfrm7Seg4IndFrame.BackRenderer.FillGradientType = NextUI.Renderer.RendererGradient.GradientType.Solid;

            for(int i = 0; i < m_ciNumOfAmpDigits; i++)
            {
                DigitalPanel7Segment seg = new DigitalPanel7Segment(nfrm7Seg4IndFrame);
                nfrm7Seg4IndFrame.Indicator.Panels.Add(seg);
                seg.BackColor = Color.Black;
                seg.MainColor = Color.White; // blue when discharging, green-yellow when charging
                seg.EnableBorder = false;
            };

            // analog amperemeter
            CircularFrame cfrmAnalogAMeterDialFrm = new CircularFrame(new Point(10, 10), this.AnalogCurrentBaseUI.Width);
            // add it to nextui container
            this.AnalogCurrentBaseUI.Frame.Add(cfrmAnalogAMeterDialFrm); // DigitalCurrentBaseUI.Frame[0] - analog meter
            // now modify circular frame in place
            cfrmAnalogAMeterDialFrm.BackRenderer.CenterColor = Color.AliceBlue;
            cfrmAnalogAMeterDialFrm.BackRenderer.EndColor = Color.Gray;
            cfrmAnalogAMeterDialFrm.FrameRenderer.Outline = NextUI.Renderer.FrameRender.FrameOutline.None;

            // now create circular bar for circular frame
            CircularScaleBar ccbrAnalogAMeterScaleBar = new CircularScaleBar(cfrmAnalogAMeterDialFrm);
            ccbrAnalogAMeterScaleBar.FillGradientType = NextUI.Renderer.RendererGradient.GradientType.Solid;
            ccbrAnalogAMeterScaleBar.ScaleBarSize = 4;
            ccbrAnalogAMeterScaleBar.FillColor = Color.White;
            ccbrAnalogAMeterScaleBar.StartValue = -50.0F; // for numerical scale only
            ccbrAnalogAMeterScaleBar.EndValue = +50.0F; // for numerical scale only
            ccbrAnalogAMeterScaleBar.StartAngle = 70; //50;
            ccbrAnalogAMeterScaleBar.SweepAngle = 40; // alignmet of moddle mark to vertical
            // major ticks
            ccbrAnalogAMeterScaleBar.MajorTickNumber = 11; // 10 A/div, difference is 10 + 1 end tick
            // alternatibvely we may supply custom labels ±
            ccbrAnalogAMeterScaleBar.CustomLabel = new string[] { "-50", "-40", "-30", "-20", "-10","-0+", "+10","+20", "+30","+40","+50"  };
            ccbrAnalogAMeterScaleBar.TickMajor.EnableGradient = false;
            ccbrAnalogAMeterScaleBar.TickMajor.EnableBorder = false;
            ccbrAnalogAMeterScaleBar.TickMajor.FillColor = Color.Honeydew; // color of outer ring and ticks
            ccbrAnalogAMeterScaleBar.TickMajor.Height = 15;
            ccbrAnalogAMeterScaleBar.TickMajor.Width = 7;
            ccbrAnalogAMeterScaleBar.TickMajor.Type = TickBase.TickType.Rectangle;
            ccbrAnalogAMeterScaleBar.TickMajor.TickPosition = TickBase.Position.Inner;
            //            ccbrAnalogAMeterScaleBar.TickMajor.TickPosition = TickBase.Position.Outer;
            // minor ticks
            ccbrAnalogAMeterScaleBar.MinorTicknumber = 5; // 2 A/div
            ccbrAnalogAMeterScaleBar.TickMinor.EnableGradient = false;
            ccbrAnalogAMeterScaleBar.TickMinor.EnableBorder = false;
            ccbrAnalogAMeterScaleBar.TickMinor.FillColor = Color.White;
            ccbrAnalogAMeterScaleBar.TickMinor.TickPosition = TickBase.Position.Inner;
            //            ccbrAnalogAMeterScaleBar.TickMinor.TickPosition = TickBase.Position.Outer;
            // scale numeric labels
            ccbrAnalogAMeterScaleBar.TickLabel.TextDirection = CircularLabel.Direction.Horizontal;
            ccbrAnalogAMeterScaleBar.TickLabel.OffsetFromScale = 35;
            ccbrAnalogAMeterScaleBar.TickLabel.LabelFont = new Font(FontFamily.GenericMonospace, 12, FontStyle.Bold);
            ccbrAnalogAMeterScaleBar.TickLabel.FontColor = Color.Black;
            // add circular bar to circular frame
            cfrmAnalogAMeterDialFrm.ScaleCollection.Add(ccbrAnalogAMeterScaleBar);

            // now construct circular pointer
            CircularPointer cptrAnalogAMeterPtr = new CircularPointer(cfrmAnalogAMeterDialFrm);
            cptrAnalogAMeterPtr.CapPointer.Visible = true;
            cptrAnalogAMeterPtr.CapOnTop = false;
            cptrAnalogAMeterPtr.BasePointer.Length = 150;
            cptrAnalogAMeterPtr.BasePointer.FillColor = Color.Black;
            cptrAnalogAMeterPtr.BasePointer.PointerShapeType = Pointerbase.PointerType.Type1;
            cptrAnalogAMeterPtr.BasePointer.OffsetFromCenter = -30;
            // add circ pointer to frame
            ccbrAnalogAMeterScaleBar.Pointer.Add(cptrAnalogAMeterPtr);
            // construct big A label
            System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
            Stream Alabel_bmp_Stream = myAssembly.GetManifestResourceStream("batt_mon_app.A.png");
            Bitmap A_label_image = new Bitmap(Alabel_bmp_Stream);
            Point ptVlablePoint = new Point(cfrmAnalogAMeterDialFrm.Rect.Width/2 - A_label_image.Width/2, (3*cfrmAnalogAMeterDialFrm.Rect.Height)/4 - A_label_image.Height);
            FrameLabel fbimage = new FrameLabel(ptVlablePoint, cfrmAnalogAMeterDialFrm);
            fbimage.BackGrdImage = A_label_image;
            // add label to frame
            cfrmAnalogAMeterDialFrm.FrameLabelCollection.Add(fbimage);
            Debug.WriteLine("--Form1::bInitAmpereMeter()=" + bRes.ToString());
            return bRes;
        }
        public MainWindow()
        {
            InitializeComponent();

            //Initializing circular gauge
            SfCircularGauge sfCircularGauge = new SfCircularGauge();

            sfCircularGauge.Height = 250;
            sfCircularGauge.Width  = 250;

            //Adding header
            sfCircularGauge.HeaderAlignment     = HeaderAlignment.Custom;
            sfCircularGauge.GaugeHeaderPosition = new Point(0.63, 0.75);
            TextBlock textBlock = new TextBlock();

            textBlock.Text              = "Temperature (K)";
            textBlock.Height            = 40;
            textBlock.Width             = 140;
            textBlock.FontSize          = 13;
            textBlock.Foreground        = new SolidColorBrush(Colors.Black);
            textBlock.FontWeight        = FontWeights.SemiBold;
            sfCircularGauge.GaugeHeader = textBlock;

            //Initializing scales for circular gauge
            CircularScale mainscale = new CircularScale();

            mainscale.RimStroke          = new SolidColorBrush(Colors.LightGray);
            mainscale.RimStrokeThickness = 3;
            mainscale.LabelOffset        = 0.1;

            MajorTickSetting majorTickSetting = new MajorTickSetting();

            majorTickSetting.StrokeThickness = 1;
            majorTickSetting.Length          = 10;
            mainscale.MajorTickSettings      = majorTickSetting;

            MinorTickSetting minorTickSetting = new MinorTickSetting();

            minorTickSetting.StrokeThickness = 1;
            minorTickSetting.Length          = 5;
            mainscale.MinorTickSettings      = minorTickSetting;

            //Adding range
            CircularRange circularRange = new CircularRange();

            circularRange.StartValue = 0;
            circularRange.EndValue   = 60;
            circularRange.Stroke     = new SolidColorBrush(Colors.Gray);
            mainscale.Ranges.Add(circularRange);

            //Adding needle pointer
            CircularPointer circularPointer = new CircularPointer();

            circularPointer.PointerType                  = PointerType.NeedlePointer;
            circularPointer.Value                        = 60;
            circularPointer.NeedleLengthFactor           = 0.5;
            circularPointer.NeedlePointerType            = NeedlePointerType.Triangle;
            circularPointer.PointerCapDiameter           = 12;
            circularPointer.NeedlePointerStroke          = (SolidColorBrush) new BrushConverter().ConvertFrom("#757575");
            circularPointer.KnobFill                     = (SolidColorBrush) new BrushConverter().ConvertFrom("#757575");
            circularPointer.KnobStroke                   = (SolidColorBrush) new BrushConverter().ConvertFrom("#757575");
            circularPointer.NeedlePointerStrokeThickness = 7;
            mainscale.Pointers.Add(circularPointer);

            //Adding range pointer
            CircularPointer circularPointer1 = new CircularPointer();

            circularPointer1.PointerType = PointerType.RangePointer;
            circularPointer1.Value       = 40;
            circularPointer1.RangePointerStrokeThickness = 5;
            circularPointer1.RangePointerStroke          = (SolidColorBrush) new BrushConverter().ConvertFrom("#27beb6");
            mainscale.Pointers.Add(circularPointer1);

            //Adding symbol pointer
            CircularPointer circularPointer2 = new CircularPointer();

            circularPointer2.PointerType         = PointerType.SymbolPointer;
            circularPointer2.Value               = 70;
            circularPointer2.SymbolPointerHeight = 12;
            circularPointer2.SymbolPointerWidth  = 12;
            circularPointer2.Symbol              = Symbol.InvertedTriangle;
            circularPointer2.SymbolPointerStroke = (SolidColorBrush) new BrushConverter().ConvertFrom("#757575");
            mainscale.Pointers.Add(circularPointer2);

            sfCircularGauge.Scales.Add(mainscale);

            this.Content = sfCircularGauge;
        }
예제 #11
0
        private bool bInitAmpereMeter()
        {
            bool bRes = false;

            Debug.WriteLine("++Form1::bInitAmpereMeter()");
// digital Amperemeter
            NumericalFrame nfrm7Seg4IndFrame = new NumericalFrame(new Rectangle(10, 10, 200, 80));

            this.DigitalCurrentBaseUI.Frame.Add(nfrm7Seg4IndFrame); // DigitalCurrentBaseUI.Frame[0] - 7-segment indicator
            nfrm7Seg4IndFrame.BackRenderer.CenterColor      = Color.Black;
            nfrm7Seg4IndFrame.BackRenderer.FillGradientType = NextUI.Renderer.RendererGradient.GradientType.Solid;

            for (int i = 0; i < m_ciNumOfAmpDigits; i++)
            {
                DigitalPanel7Segment seg = new DigitalPanel7Segment(nfrm7Seg4IndFrame);
                nfrm7Seg4IndFrame.Indicator.Panels.Add(seg);
                seg.BackColor    = Color.Black;
                seg.MainColor    = Color.White; // blue when discharging, green-yellow when charging
                seg.EnableBorder = false;
            }
            ;

// analog amperemeter
            CircularFrame cfrmAnalogAMeterDialFrm = new CircularFrame(new Point(10, 10), this.AnalogCurrentBaseUI.Width);

// add it to nextui container
            this.AnalogCurrentBaseUI.Frame.Add(cfrmAnalogAMeterDialFrm); // DigitalCurrentBaseUI.Frame[0] - analog meter
// now modify circular frame in place
            cfrmAnalogAMeterDialFrm.BackRenderer.CenterColor = Color.AliceBlue;
            cfrmAnalogAMeterDialFrm.BackRenderer.EndColor    = Color.Gray;
            cfrmAnalogAMeterDialFrm.FrameRenderer.Outline    = NextUI.Renderer.FrameRender.FrameOutline.None;

// now create circular bar for circular frame
            CircularScaleBar ccbrAnalogAMeterScaleBar = new CircularScaleBar(cfrmAnalogAMeterDialFrm);

            ccbrAnalogAMeterScaleBar.FillGradientType = NextUI.Renderer.RendererGradient.GradientType.Solid;
            ccbrAnalogAMeterScaleBar.ScaleBarSize     = 4;
            ccbrAnalogAMeterScaleBar.FillColor        = Color.White;
            ccbrAnalogAMeterScaleBar.StartValue       = -50.0F; // for numerical scale only
            ccbrAnalogAMeterScaleBar.EndValue         = +50.0F; // for numerical scale only
            ccbrAnalogAMeterScaleBar.StartAngle       = 70;     //50;
            ccbrAnalogAMeterScaleBar.SweepAngle       = 40;     // alignmet of moddle mark to vertical
// major ticks
            ccbrAnalogAMeterScaleBar.MajorTickNumber = 11;      // 10 A/div, difference is 10 + 1 end tick
// alternatibvely we may supply custom labels ±
            ccbrAnalogAMeterScaleBar.CustomLabel = new string[] { "-50", "-40", "-30", "-20", "-10", "-0+", "+10", "+20", "+30", "+40", "+50" };
            ccbrAnalogAMeterScaleBar.TickMajor.EnableGradient = false;
            ccbrAnalogAMeterScaleBar.TickMajor.EnableBorder   = false;
            ccbrAnalogAMeterScaleBar.TickMajor.FillColor      = Color.Honeydew; // color of outer ring and ticks
            ccbrAnalogAMeterScaleBar.TickMajor.Height         = 15;
            ccbrAnalogAMeterScaleBar.TickMajor.Width          = 7;
            ccbrAnalogAMeterScaleBar.TickMajor.Type           = TickBase.TickType.Rectangle;
            ccbrAnalogAMeterScaleBar.TickMajor.TickPosition   = TickBase.Position.Inner;
//            ccbrAnalogAMeterScaleBar.TickMajor.TickPosition = TickBase.Position.Outer;
// minor ticks
            ccbrAnalogAMeterScaleBar.MinorTicknumber          = 5; // 2 A/div
            ccbrAnalogAMeterScaleBar.TickMinor.EnableGradient = false;
            ccbrAnalogAMeterScaleBar.TickMinor.EnableBorder   = false;
            ccbrAnalogAMeterScaleBar.TickMinor.FillColor      = Color.White;
            ccbrAnalogAMeterScaleBar.TickMinor.TickPosition   = TickBase.Position.Inner;
//            ccbrAnalogAMeterScaleBar.TickMinor.TickPosition = TickBase.Position.Outer;
// scale numeric labels
            ccbrAnalogAMeterScaleBar.TickLabel.TextDirection   = CircularLabel.Direction.Horizontal;
            ccbrAnalogAMeterScaleBar.TickLabel.OffsetFromScale = 35;
            ccbrAnalogAMeterScaleBar.TickLabel.LabelFont       = new Font(FontFamily.GenericMonospace, 12, FontStyle.Bold);
            ccbrAnalogAMeterScaleBar.TickLabel.FontColor       = Color.Black;
// add circular bar to circular frame
            cfrmAnalogAMeterDialFrm.ScaleCollection.Add(ccbrAnalogAMeterScaleBar);

// now construct circular pointer
            CircularPointer cptrAnalogAMeterPtr = new CircularPointer(cfrmAnalogAMeterDialFrm);

            cptrAnalogAMeterPtr.CapPointer.Visible           = true;
            cptrAnalogAMeterPtr.CapOnTop                     = false;
            cptrAnalogAMeterPtr.BasePointer.Length           = 150;
            cptrAnalogAMeterPtr.BasePointer.FillColor        = Color.Black;
            cptrAnalogAMeterPtr.BasePointer.PointerShapeType = Pointerbase.PointerType.Type1;
            cptrAnalogAMeterPtr.BasePointer.OffsetFromCenter = -30;
// add circ pointer to frame
            ccbrAnalogAMeterScaleBar.Pointer.Add(cptrAnalogAMeterPtr);
// construct big A label
            System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
            Stream     Alabel_bmp_Stream          = myAssembly.GetManifestResourceStream("batt_mon_app.A.png");
            Bitmap     A_label_image = new Bitmap(Alabel_bmp_Stream);
            Point      ptVlablePoint = new Point(cfrmAnalogAMeterDialFrm.Rect.Width / 2 - A_label_image.Width / 2, (3 * cfrmAnalogAMeterDialFrm.Rect.Height) / 4 - A_label_image.Height);
            FrameLabel fbimage       = new FrameLabel(ptVlablePoint, cfrmAnalogAMeterDialFrm);

            fbimage.BackGrdImage = A_label_image;
// add label to frame
            cfrmAnalogAMeterDialFrm.FrameLabelCollection.Add(fbimage);
            Debug.WriteLine("--Form1::bInitAmpereMeter()=" + bRes.ToString());
            return(bRes);
        }
예제 #12
0
        private bool bInitVoltmeter()
        {
            bool bRes=false;
            Debug.WriteLine("++Form1::bInitVoltmeter()");
            // Numerical frame 3 - n+3 range digital 7-segment thin line counter
            // rectangular frame - place in the bottom quarter, in the center, autosize
            NumericalFrame nfrm7SegIndFrame = new NumericalFrame(new Rectangle(10, 10, 180, 80));
            this.DigitalVoltmBaseUI.Frame.Add(nfrm7SegIndFrame); // DigitalVoltmBaseUI.Frame[0] - 7-segment indicator
            nfrm7SegIndFrame.BackRenderer.CenterColor = Color.Black;
            nfrm7SegIndFrame.BackRenderer.FillGradientType = NextUI.Renderer.RendererGradient.GradientType.Solid;

            for(int i = 0; i < m_ciNumOfVoltmDigits; i++)
            {
                DigitalPanel7Segment seg = new DigitalPanel7Segment(nfrm7SegIndFrame);
                nfrm7SegIndFrame.Indicator.Panels.Add(seg);
                seg.BackColor = Color.Black;
                seg.MainColor = Color.Red;
                seg.EnableBorder = false;
            };

            nfrm7SegIndFrame.Indicator.Panels[m_ciNumOfVoltmDigits - 3].MainColor = Color.Yellow; // highest digit
            nfrm7SegIndFrame.Indicator.Panels[m_ciNumOfVoltmDigits - 2].MainColor = Color.Yellow;
            nfrm7SegIndFrame.Indicator.Panels[m_ciNumOfVoltmDigits - 1].MainColor = Color.Yellow; // lowest digit
            //
            //------------------------------------------------------------------------------------------------------
            // construct one big analog voltmeter meter 10-16 V //
            // circular frame - place in the top half, in the center, autosize
            CircularFrame cfrmAnalogVMeterDialFrm = new CircularFrame(new Point(10, 10), this.AnalogVoltmBaseUI.Width);
            // add it to nextui container
            this.AnalogVoltmBaseUI.Frame.Add(cfrmAnalogVMeterDialFrm); // AnalogVoltmBaseUI.Frame[0] - analog meter
            // now modify circular frame in place
            cfrmAnalogVMeterDialFrm.BackRenderer.CenterColor = Color.AliceBlue;
            cfrmAnalogVMeterDialFrm.BackRenderer.EndColor = Color.Gray;
            cfrmAnalogVMeterDialFrm.FrameRenderer.Outline = NextUI.Renderer.FrameRender.FrameOutline.None;

            // now create circular bar for circular frame
            CircularScaleBar ccbrAnalogVMeterScaleBar = new CircularScaleBar(cfrmAnalogVMeterDialFrm);
            ccbrAnalogVMeterScaleBar.FillGradientType = NextUI.Renderer.RendererGradient.GradientType.Solid;
            ccbrAnalogVMeterScaleBar.ScaleBarSize = 4;
            ccbrAnalogVMeterScaleBar.FillColor = Color.White;
            ccbrAnalogVMeterScaleBar.StartValue = 10.0F; // for numerical scale only
            ccbrAnalogVMeterScaleBar.EndValue = 15.0F; // for numerical scale only
            ccbrAnalogVMeterScaleBar.StartAngle = 70; //50;
            ccbrAnalogVMeterScaleBar.SweepAngle = 70;
            // major ticks
            ccbrAnalogVMeterScaleBar.MajorTickNumber = 6; // 1 V/div, difference is 6 + 1 end tick
            ccbrAnalogVMeterScaleBar.TickMajor.EnableGradient = false;
            ccbrAnalogVMeterScaleBar.TickMajor.EnableBorder = false;
            ccbrAnalogVMeterScaleBar.TickMajor.FillColor = Color.Honeydew; // color of outer ring and ticks
            ccbrAnalogVMeterScaleBar.TickMajor.Height = 15;
            ccbrAnalogVMeterScaleBar.TickMajor.Width = 7;
            ccbrAnalogVMeterScaleBar.TickMajor.Type = TickBase.TickType.Rectangle;
            ccbrAnalogVMeterScaleBar.TickMajor.TickPosition = TickBase.Position.Inner;
            // minor ticks
            ccbrAnalogVMeterScaleBar.MinorTicknumber = 5; // 0.2 V/div
            ccbrAnalogVMeterScaleBar.TickMinor.EnableGradient = false;
            ccbrAnalogVMeterScaleBar.TickMinor.EnableBorder = false;
            ccbrAnalogVMeterScaleBar.TickMinor.FillColor = Color.White;
            ccbrAnalogVMeterScaleBar.TickMinor.TickPosition = TickBase.Position.Inner;
            // scale numeric labels
            ccbrAnalogVMeterScaleBar.TickLabel.TextDirection = CircularLabel.Direction.Horizontal;
            ccbrAnalogVMeterScaleBar.TickLabel.OffsetFromScale = 35;
            ccbrAnalogVMeterScaleBar.TickLabel.LabelFont = new Font(FontFamily.GenericMonospace, 12, FontStyle.Bold);
            ccbrAnalogVMeterScaleBar.TickLabel.FontColor = Color.Black;
            // add circular bar to circular frame
            cfrmAnalogVMeterDialFrm.ScaleCollection.Add(ccbrAnalogVMeterScaleBar);

            // now construct circular pointer
            CircularPointer cptrAnalogVMeterPtr = new CircularPointer(cfrmAnalogVMeterDialFrm);
            cptrAnalogVMeterPtr.CapPointer.Visible = true;
            cptrAnalogVMeterPtr.CapOnTop = false;
            cptrAnalogVMeterPtr.BasePointer.Length = 150;
            cptrAnalogVMeterPtr.BasePointer.FillColor = Color.Black;
            cptrAnalogVMeterPtr.BasePointer.PointerShapeType = Pointerbase.PointerType.Type1;
            cptrAnalogVMeterPtr.BasePointer.OffsetFromCenter = -30;
            // add circ pointer to frame
            ccbrAnalogVMeterScaleBar.Pointer.Add(cptrAnalogVMeterPtr);

            // construct big V label
            System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
            Stream Vlabel_bmp_Stream = myAssembly.GetManifestResourceStream("batt_mon_app.V.png");
            Bitmap V_label_image = new Bitmap(Vlabel_bmp_Stream);
            Point ptVlablePoint = new Point(cfrmAnalogVMeterDialFrm.Rect.Width/2 - V_label_image.Width/2-10, (3*cfrmAnalogVMeterDialFrm.Rect.Height)/4 - V_label_image.Height);
            FrameLabel fbimage = new FrameLabel(ptVlablePoint, cfrmAnalogVMeterDialFrm);
            fbimage.BackGrdImage = V_label_image;
            // add label to frame
            cfrmAnalogVMeterDialFrm.FrameLabelCollection.Add(fbimage);

            #if VOLTMETERTIMER
            // start voltmeter timer
            m_VMeterTimer = new System.Windows.Forms.Timer();
            m_VMeterTimer.Interval=100;
            m_VMeterTimer.Tick += new EventHandler(Vmeter_timer_Funkt);
            Debug.WriteLine("Form1() bInitVoltmeter() Vmeter timer is up; rate="+(1000/m_VMeterTimer.Interval).ToString() + " Hz");
            m_VMeterTimer.Start();
            #endif
            Debug.WriteLine("--Form1::bInitVoltmeter()=" + bRes.ToString());
            return bRes;
        }
예제 #13
0
        /// <summary>
        /// Initializes the log.
        /// </summary>
        public void InitializeLog()
        {
            m_scale = new CircularScale();
            m_scale.ShadowOffset       = 1;
            m_scale.Minimum            = 0;
            m_scale.Maximum            = 100;
            m_scale.MinorIntervalValue = 5;
            m_scale.MajorIntervalValue = 20;
            m_scale.StartAngle         = 120;
            m_scale.GapSweepAngle      = 300;
            m_scale.ScaleBarSize       = 7;
            m_scale.Radius             = 60;
            m_scale.BorderWidth        = 1.0;


            m_scale1 = new CircularScale();
            m_scale1.ShadowOffset       = 1;
            m_scale1.Minimum            = 0;
            m_scale1.Maximum            = 100;
            m_scale1.MinorIntervalValue = 5;
            m_scale1.MajorIntervalValue = 10;
            m_scale1.StartAngle         = 120;
            m_scale1.GapSweepAngle      = 300;
            m_scale1.ScaleBarSize       = 0.5;
            m_scale1.Radius             = 40;
            m_scale1.BorderWidth        = 1.2;


            this.circularGauge1.Scales.Add(m_scale);
            this.circularGauge1.Scales.Add(m_scale1);


            CircularLabelTick majorLabelTick = new CircularLabelTick();

            majorLabelTick.FontSize          = 13;
            majorLabelTick.TickStyle         = TickStyle.MajorTick;
            majorLabelTick.TickPlacement     = ScalePlacement.Inside;
            majorLabelTick.DistanceFromScale = 5;

            CircularMarkTick majorTick = new CircularMarkTick();

            majorTick.TickWidth  = 5;
            majorTick.TickHeight = 10;
            majorTick.TickStyle  = TickStyle.MajorTick;
            majorTick.TickShape  = TickShape.RoundedRectangle;


            CircularMarkTick minorTick = new CircularMarkTick();

            minorTick.TickWidth  = 1;
            minorTick.TickHeight = 4;
            minorTick.TickStyle  = TickStyle.MinorTick;

            CircularLabelTick majorLabelTick1 = new CircularLabelTick();

            majorLabelTick1.FontSize  = 11;
            majorLabelTick1.TickStyle = TickStyle.MajorTick;


            majorLabelTick1.TickPlacement     = ScalePlacement.Inside;
            majorLabelTick1.DistanceFromScale = 5;

            CircularMarkTick majorTick1 = new CircularMarkTick();

            majorTick1.TickWidth  = 4;
            majorTick1.TickHeight = 9;
            majorTick1.TickStyle  = TickStyle.MajorTick;
            majorTick1.TickShape  = TickShape.Ellipse;

            CircularMarkTick minorTick1 = new CircularMarkTick();

            minorTick1.TickWidth  = 1;
            minorTick1.TickHeight = 4;
            minorTick1.TickStyle  = TickStyle.MinorTick;


            m_scale.Ticks.Add(minorTick);
            m_scale.Ticks.Add(majorTick);
            m_scale.Ticks.Add(majorLabelTick);

            m_scale1.Ticks.Add(minorTick1);
            m_scale1.Ticks.Add(majorTick1);
            m_scale1.Ticks.Add(majorLabelTick1);


            m_scale.PointerCap.PointerCapRadius  = 7;
            m_scale1.PointerCap.PointerCapRadius = 7;


            CircularPointer pointer1 = new CircularPointer();

            pointer1.BorderWidth      = 0.3;
            pointer1.PointerLength    = 40;
            pointer1.PointerWidth     = 10;
            pointer1.PointerPlacement = ScalePlacement.Outside;


            CircularPointer pointer3 = new CircularPointer();

            pointer3.BorderWidth      = 0.3;
            pointer3.PointerLength    = 70;
            pointer3.PointerWidth     = 10;
            pointer3.Value            = 50;
            pointer3.PointerPlacement = ScalePlacement.Outside;


            m_scale.Pointers.Add(pointer1);
            m_scale1.Pointers.Add(pointer3);

            // Subscribe GapSweepAngle property changed event
            m_scale.GapSweepAngleChanged += new PropertyChangedCallback(m_scale_GapSweepAngleChanged);
            // Subscribe GapSweepAngle property changed event
            m_scale1.GapSweepAngleChanged += new PropertyChangedCallback(m_scale1_GapSweepAngleChanged);
            // Subscribe Location property changed event
            m_scale.LocationChanged += new PropertyChangedCallback(m_scale_LocationChanged);
            // Subscribe Location property changed event
            m_scale1.LocationChanged += new PropertyChangedCallback(m_scale1_LocationChanged);
            // Subscribe Maximum property changed event
            m_scale.MaximumChanged += new PropertyChangedCallback(m_scale_MaximumChanged);
            // Subscribe Maximum property changed event
            m_scale1.MaximumChanged += new PropertyChangedCallback(m_scale1_MaximumChanged);
            // Subscribe Minimum property changed event
            m_scale1.MinimumChanged += new PropertyChangedCallback(m_scale1_MinimumChanged);
            // Subscribe Minimum property changed event
            m_scale.MinimumChanged += new PropertyChangedCallback(m_scale_MinimumChanged);
            // Subscribe MajorIntervalValue property changed event
            m_scale.MajorIntervalValueChanged += new PropertyChangedCallback(m_scale_MajorIntervalValueChanged);
            // Subscribe MinorIntervalValue property changed event
            m_scale.MinorIntervalValueChanged += new PropertyChangedCallback(m_scale1_MinorIntervalValueChanged);
            // Subscribe StartAngle property changed event
            m_scale.StartAngleChanged += new PropertyChangedCallback(m_scale_StartAngleChanged);
            // Subscribe StartAngle property changed event
            m_scale1.StartAngleChanged += new PropertyChangedCallback(m_scale1_StartAngleChanged);
            // Subscribe Radius property changed event
            m_scale.RadiusChanged += new PropertyChangedCallback(m_scale_RadiusChanged);
            // Subscribe Radius property changed event
            m_scale1.RadiusChanged += new PropertyChangedCallback(m_scale1_RadiusChanged);
            // Subscribe BorderWidth property changed event
            //m_scale.BorderWidthChanged += new PropertyChangedCallback(m_scale_BorderWidthChanged);
            // Subscribe BorderWidth property changed event
            //m_scale1.BorderWidthChanged += new PropertyChangedCallback(m_scale1_BorderWidthChanged);
            // Subscribe ScaleBarSize property changed event
            m_scale.ScaleBarSizeChanged += new PropertyChangedCallback(m_scale_ScaleBarSizeChanged);
            // Subscribe ScaleBarSize property changed event
            m_scale1.ScaleBarSizeChanged += new PropertyChangedCallback(m_scale1_ScaleBarSizeChanged);
            // Subscribe Value property changed event
            (m_scale.Pointers[0] as CircularPointer).ValueChanged += new PropertyChangedCallback(Changed);

            ScaleRadiusSlider.Value  = 90;
            ScaleRadiusSlider1.Value = 60;
        }
예제 #14
0
    public void SetGuageLayout2(GaugeContainer iGauge, GAUGE_COLOR_TYPE iColorType, double iRate)
    {
        Font fntDefault = new Font("", 12f, FontStyle.Regular, GraphicsUnit.Pixel);

        // Gauge 기본설정
        iGauge.Height     = Unit.Pixel(130);
        iGauge.Width      = Unit.Pixel(200);
        iGauge.AutoLayout = true;

        iGauge.BackFrame.BorderColor  = Color.FromArgb(212, 208, 200);
        iGauge.BackFrame.BorderWidth  = 0;
        iGauge.BackFrame.FrameWidth   = 0f;
        iGauge.BackFrame.FrameStyle   = BackFrameStyle.None;
        iGauge.BackFrame.FrameShape   = BackFrameShape.AutoShape;
        iGauge.BackFrame.ShadowOffset = 0f;
        iGauge.BackFrame.BorderStyle  = GaugeDashStyle.NotSet;

        //iGauge.MapAreas.Clear();
        //iGauge.StateIndicators.Clear();

        // 원형게이지 설정
        iGauge.CircularGauges.Clear();
        iGauge.CircularGauges.Add("Default");
        CircularGauge cclg = iGauge.CircularGauges[0];

        cclg.Size.Width   = 100f;
        cclg.Size.Height  = 96f;
        cclg.PivotPoint.X = 50f;
        cclg.PivotPoint.Y = 87f;

        cclg.BackFrame.BackGradientType  = Dundas.Gauges.WebControl.GradientType.None;
        cclg.BackFrame.BorderColor       = Color.Transparent;
        cclg.BackFrame.BorderWidth       = 0;
        cclg.BackFrame.FrameGradientType = Dundas.Gauges.WebControl.GradientType.None;
        cclg.BackFrame.FrameStyle        = BackFrameStyle.None;
        cclg.BackFrame.FrameShape        = BackFrameShape.AutoShape;
        cclg.BackFrame.FrameWidth        = 0f;
        cclg.Location.X = 0f;
        cclg.Location.Y = 0f;

        cclg.Knobs.Clear();
        cclg.Ranges.Clear();

        // 게이지 제목 설정
        iGauge.Labels.Clear();
        iGauge.Labels.Add("Default");


        GaugeLabel gglt = iGauge.Labels[0];

        gglt.BackColor        = Color.Transparent;
        gglt.BackGradientType = Dundas.Gauges.WebControl.GradientType.None;
        //gglt.Parent = cclg.Name;
        gglt.Text          = "달성율(%)";
        gglt.TextAlignment = ContentAlignment.MiddleCenter;
        gglt.Size.Height   = 11f;
        gglt.Size.Width    = 30f;
        gglt.Location.X    = 36f;
        gglt.Location.Y    = 46f;
        gglt.Font          = fntDefault;

        // 게이지 눈금 설정
        cclg.Scales.Clear();
        cclg.Scales.Add("Default");
        CircularScale ccls = cclg.Scales[0];

        ccls.BorderColor      = Color.Gray;
        ccls.FillColor        = ColorTranslator.FromHtml("#5A78AF"); // #ADC9DC
        ccls.Radius           = 73f;
        ccls.ShadowOffset     = 0f;
        ccls.StartAngle       = 80f;
        ccls.SweepAngle       = 200f;
        ccls.Width            = 25f;
        ccls.FillGradientType = Dundas.Gauges.WebControl.GradientType.None;
        ccls.FillHatchStyle   = GaugeHatchStyle.None;

        ccls.LabelStyle.DistanceFromScale = 5f;
        ccls.LabelStyle.Placement         = Placement.Inside;
        ccls.LabelStyle.TextColor         = Color.Black;
        ccls.LabelStyle.Font = fntDefault;

        ccls.MajorTickMark.BorderColor       = ColorTranslator.FromHtml("#E0E8F3");
        ccls.MajorTickMark.BorderWidth       = 0;
        ccls.MajorTickMark.DistanceFromScale = 1f;
        ccls.MajorTickMark.FillColor         = ColorTranslator.FromHtml("#E0E8F3");
        ccls.MajorTickMark.Length            = ccls.Width;
        ccls.MajorTickMark.Placement         = Placement.Cross;
        ccls.MajorTickMark.Shape             = Dundas.Gauges.WebControl.MarkerStyle.None;
        ccls.MajorTickMark.Width             = 5f;
        ccls.MajorTickMark.EnableGradient    = false;

        ccls.MinorTickMark.Visible           = false;
        ccls.MinorTickMark.BorderColor       = ccls.MajorTickMark.BorderColor;
        ccls.MinorTickMark.BorderWidth       = 1;
        ccls.MinorTickMark.DistanceFromScale = 1f;
        ccls.MinorTickMark.FillColor         = ccls.MajorTickMark.FillColor;
        ccls.MinorTickMark.Length            = 7f;
        ccls.MinorTickMark.Placement         = Placement.Outside;
        ccls.MinorTickMark.Shape             = Dundas.Gauges.WebControl.MarkerStyle.Wedge;
        ccls.MinorTickMark.Width             = 2f;
        ccls.MinorTickMark.EnableGradient    = false;

        // 게이지 바늘 설정
        cclg.Pointers.Clear();
        cclg.Pointers.Add("Default");
        CircularPointer cclp = cclg.Pointers[0];

        cclp.BorderWidth          = 0;
        cclp.FillGradientEndColor = Color.MediumTurquoise;
        cclp.DistanceFromScale    = 1f;
        cclp.FillColor            = Color.Red;
        cclp.FillGradientEndColor = Color.Pink;
        cclp.FillGradientType     = Dundas.Gauges.WebControl.GradientType.LeftRight;
        cclp.NeedleStyle          = NeedleStyle.NeedleStyle4;
        cclp.Placement            = Placement.Cross;
        cclp.Width                   = 2f;
        cclp.ShadowOffset            = 3f;
        cclp.CapFillColor            = ColorTranslator.FromHtml("#DFE8ED");
        cclp.CapFillGradientEndColor = ColorTranslator.FromHtml("#508EBF");
        cclp.CapFillGradientType     = Dundas.Gauges.WebControl.GradientType.DiagonalLeft;
        cclp.CapReflection           = true;
        cclp.CapWidth                = 50f;

        double dMax = iRate;

        if (100 < iRate)
        {
            dMax = (iRate - (iRate % 20)) + 20;
            //dMax = Math.Round(iRate,0);
        }
        else
        {
            dMax = 100;
        }

        cclp.Value    = iRate;
        ccls.Maximum  = dMax;
        ccls.Minimum  = 0;
        ccls.Interval = Math.Round(dMax / 10);

        gglt.Text = Math.Round(iRate, 0).ToString() + "%";
    }
예제 #15
0
    /// <summary>
    /// 주요지표 스키마 추가 및 데이터 바인딩
    /// YMD | E | G | W | A | 매출액 | 공급량 | ...
    /// </summary>
    /// <returns></returns>
    //public DataTable GetGradeSchema(DataTable iDt)
    //{
    //    DateTime startYM = (DateTime.ParseExact(this.IYmd, "yyyyMM", null)).AddYears(-1);
    //    DataTable dtGrade = iDt;
    //    Biz_Bsc_Kpi_Dashboard objTC = new Biz_Bsc_Kpi_Dashboard();
    //    DataSet dsGrade = objTC.GetDashBoardKpiList(this.IEstTermRefID);
    //    DataRow drGrade = null;

    //    iRow = dsGrade.Tables[0].Rows.Count;
    //    for (int i = 0; i < iRow; i++)
    //    {
    //            DataColumn dc = dtGrade.Columns.Add(dsGrade.Tables[0].Rows[i]["KPI_REF_ID"].ToString(), typeof(decimal));
    //            dc.Caption    = dsGrade.Tables[0].Rows[i]["NAME_KNAME"].ToString();
    //    }

    //    DataSet actDs = new DataSet();

    //    string sKpiNm   = "";
    //    string sUnitNm  = "";
    //    decimal dTarget = 0;
    //    decimal dResult = 0;
    //    double dAVRate  = 0;
    //    string sColT = (this.ISumType == "MS") ? "TARGET_MS" : "TARGET_TS";
    //    string sColR = (this.ISumType == "MS") ? "RESULT_MS" : "RESULT_TS";
    //    string sColA = (this.ISumType == "MS") ? "ACHV_RATE_MS" : "ACHV_RATE_TS";

    //    if (dsGrade.Tables.Count > 0)
    //    {
    //        iRow = dsGrade.Tables[0].Rows.Count;
    //        for (int i = 0; i < iRow; i++)
    //        {
    //            this.IKpiRefID = int.Parse(dsGrade.Tables[0].Rows[i]["KPI_REF_ID"].ToString());
    //            actDs = objTC.GetDashBoardForKpiAnalysis( this.IEstTermRefID, this.IKpiRefID
    //                                                    , base.GetYMDFromDateTime(startYM, "").Substring(0, 6)
    //                                                    , this.IYmd, this.ISumType);

    //            if (actDs.Tables.Count > 0)
    //            {
    //                if (actDs.Tables[0].Rows.Count > 0)
    //                {
    //                    string sYmd = "";
    //                    for (int k = 0; k < dtGrade.Rows.Count; k++)
    //                    {
    //                        if (sYmd.Equals(dtGrade.Rows[k][COL_KEY.KEY_FIELD.ToString()].ToString()) && dtGrade.Columns.Contains(sKey))
    //                        {
    //                            dtGrade.Rows[k][sKey] = dVal;
    //                        }
    //                    }



    //                    dTarget = decimal.Parse(actDs.Tables[0].Rows[0][sColT].ToString());
    //                    dResult = decimal.Parse(actDs.Tables[0].Rows[0][sColR].ToString());
    //                    dAVRate = double.Parse(actDs.Tables[0].Rows[0][sColA].ToString());
    //                }
    //            }
    //        }
    //    }

    //    return dtGrade;
    //}


    #endregion

    #region [지표현황 - 게이지 설정]
    public void SetGuageLayout(GaugeContainer iGauge, GAUGE_COLOR_TYPE iColorType)
    {
        iGauge.Height     = Unit.Pixel(130);
        iGauge.Width      = Unit.Pixel(240);
        iGauge.AutoLayout = false;

        iGauge.BackFrame.BorderColor  = Color.FromArgb(212, 208, 200);
        iGauge.BackFrame.BorderWidth  = 0;
        iGauge.BackFrame.FrameWidth   = 0f;
        iGauge.BackFrame.FrameStyle   = BackFrameStyle.None;
        iGauge.BackFrame.FrameShape   = BackFrameShape.AutoShape;
        iGauge.BackFrame.ShadowOffset = 0f;
        iGauge.BackFrame.BorderStyle  = GaugeDashStyle.NotSet;

        iGauge.CircularGauges.Clear();
        iGauge.CircularGauges.Add("Default");
        CircularGauge cclg = iGauge.CircularGauges[0];

        cclg.Size.Width                     = 100f;
        cclg.Size.Height                    = 96f;
        cclg.PivotPoint.X                   = 50f;
        cclg.PivotPoint.Y                   = 87f;
        cclg.BackFrame.BackColor            = arrColor[(int)iColorType, 0];
        cclg.BackFrame.BackGradientEndColor = arrColor[(int)iColorType, 1];
        cclg.BackFrame.BackGradientType     = Dundas.Gauges.WebControl.GradientType.TopBottom;
        cclg.BackFrame.BorderColor          = Color.DarkGray;
        cclg.BackFrame.BorderWidth          = 2;
        cclg.BackFrame.FrameGradientType    = Dundas.Gauges.WebControl.GradientType.None;
        cclg.BackFrame.FrameStyle           = BackFrameStyle.Edged;
        cclg.BackFrame.FrameShape           = BackFrameShape.AutoShape;
        cclg.BackFrame.FrameWidth           = 0f;
        cclg.Location.X                     = 0f;
        cclg.Location.Y                     = 0f;

        cclg.Ranges.Clear();
        //cclg.Ranges.Add("Alert");
        //CircularRange cclr = cclg.Ranges[0];
        //cclr.StartValue = 0;
        //cclr.EndValue   = 50;
        //cclr.StartWidth = 200f;
        //cclr.EndWidth   = 200f;

        iGauge.Labels.Clear();
        iGauge.Labels.Add("Default");
        GaugeLabel gglt = iGauge.Labels[0];

        gglt.BackColor        = Color.Transparent;
        gglt.BackGradientType = Dundas.Gauges.WebControl.GradientType.None;
        //gglt.Parent = cclg.Name;
        gglt.Text          = "단위";
        gglt.TextAlignment = ContentAlignment.MiddleCenter;
        gglt.Size.Height   = 11f;
        gglt.Size.Width    = 30f;
        gglt.Location.X    = 36f;
        gglt.Location.Y    = 46f;


        cclg.Scales.Clear();
        cclg.Scales.Add("Default");
        CircularScale ccls = cclg.Scales[0];

        ccls.BorderColor  = Color.Gray;
        ccls.FillColor    = Color.Black;
        ccls.Radius       = 58f;
        ccls.ShadowOffset = 0f;
        ccls.StartAngle   = 90f;
        ccls.SweepAngle   = 180f;
        ccls.Width        = 1f;

        ccls.LabelStyle.DistanceFromScale = 5f;
        ccls.LabelStyle.Placement         = Placement.Outside;
        ccls.LabelStyle.TextColor         = Color.Black;

        ccls.MajorTickMark.BorderColor       = Color.Black;
        ccls.MajorTickMark.BorderWidth       = 1;
        ccls.MajorTickMark.DistanceFromScale = 1f;
        ccls.MajorTickMark.FillColor         = Color.Black;
        ccls.MajorTickMark.Length            = 10f;
        ccls.MajorTickMark.Placement         = Placement.Outside;
        ccls.MajorTickMark.Shape             = Dundas.Gauges.WebControl.MarkerStyle.Wedge;
        ccls.MajorTickMark.Width             = 2f;

        ccls.MinorTickMark.BorderColor       = ccls.MajorTickMark.BorderColor;
        ccls.MinorTickMark.BorderWidth       = 1;
        ccls.MinorTickMark.DistanceFromScale = 1f;
        ccls.MinorTickMark.FillColor         = ccls.MajorTickMark.FillColor;
        ccls.MinorTickMark.Length            = 7f;
        ccls.MinorTickMark.Placement         = Placement.Outside;
        ccls.MinorTickMark.Shape             = Dundas.Gauges.WebControl.MarkerStyle.Wedge;
        ccls.MinorTickMark.Width             = 2f;
        ccls.MinorTickMark.EnableGradient    = false;

        cclg.Pointers.Clear();
        CircularPointer cclp = cclg.Pointers[0];

        cclp.BorderWidth          = 0;
        cclp.CapFillColor         = Color.Silver;
        cclp.FillGradientEndColor = Color.MediumTurquoise;
        cclp.CapReflection        = true;
        cclp.CapWidth             = 20f;
        cclp.DistanceFromScale    = 1f;
        cclp.FillColor            = Color.Red;
        cclp.FillGradientEndColor = Color.Pink;
        cclp.FillGradientType     = Dundas.Gauges.WebControl.GradientType.LeftRight;
        cclp.NeedleStyle          = NeedleStyle.NeedleStyle4;
        cclp.Placement            = Placement.Outside;
        cclp.Width = 13f;

        cclp.SnappingEnabled  = true;
        cclp.SnappingInterval = 1;


        cclp.Value   = 50;
        ccls.Maximum = 100;
        ccls.Minimum = 0;
    }
예제 #16
0
        private bool bInitVoltmeter()
        {
            bool bRes = false;

            Debug.WriteLine("++Form1::bInitVoltmeter()");
// Numerical frame 3 - n+3 range digital 7-segment thin line counter
// rectangular frame - place in the bottom quarter, in the center, autosize
            NumericalFrame nfrm7SegIndFrame = new NumericalFrame(new Rectangle(10, 10, 180, 80));

            this.DigitalVoltmBaseUI.Frame.Add(nfrm7SegIndFrame); // DigitalVoltmBaseUI.Frame[0] - 7-segment indicator
            nfrm7SegIndFrame.BackRenderer.CenterColor      = Color.Black;
            nfrm7SegIndFrame.BackRenderer.FillGradientType = NextUI.Renderer.RendererGradient.GradientType.Solid;

            for (int i = 0; i < m_ciNumOfVoltmDigits; i++)
            {
                DigitalPanel7Segment seg = new DigitalPanel7Segment(nfrm7SegIndFrame);
                nfrm7SegIndFrame.Indicator.Panels.Add(seg);
                seg.BackColor    = Color.Black;
                seg.MainColor    = Color.Red;
                seg.EnableBorder = false;
            }
            ;

            nfrm7SegIndFrame.Indicator.Panels[m_ciNumOfVoltmDigits - 3].MainColor = Color.Yellow; // highest digit
            nfrm7SegIndFrame.Indicator.Panels[m_ciNumOfVoltmDigits - 2].MainColor = Color.Yellow;
            nfrm7SegIndFrame.Indicator.Panels[m_ciNumOfVoltmDigits - 1].MainColor = Color.Yellow; // lowest digit
//
//------------------------------------------------------------------------------------------------------
// construct one big analog voltmeter meter 10-16 V //
// circular frame - place in the top half, in the center, autosize
            CircularFrame cfrmAnalogVMeterDialFrm = new CircularFrame(new Point(10, 10), this.AnalogVoltmBaseUI.Width);

// add it to nextui container
            this.AnalogVoltmBaseUI.Frame.Add(cfrmAnalogVMeterDialFrm); // AnalogVoltmBaseUI.Frame[0] - analog meter
// now modify circular frame in place
            cfrmAnalogVMeterDialFrm.BackRenderer.CenterColor = Color.AliceBlue;
            cfrmAnalogVMeterDialFrm.BackRenderer.EndColor    = Color.Gray;
            cfrmAnalogVMeterDialFrm.FrameRenderer.Outline    = NextUI.Renderer.FrameRender.FrameOutline.None;

// now create circular bar for circular frame
            CircularScaleBar ccbrAnalogVMeterScaleBar = new CircularScaleBar(cfrmAnalogVMeterDialFrm);

            ccbrAnalogVMeterScaleBar.FillGradientType = NextUI.Renderer.RendererGradient.GradientType.Solid;
            ccbrAnalogVMeterScaleBar.ScaleBarSize     = 4;
            ccbrAnalogVMeterScaleBar.FillColor        = Color.White;
            ccbrAnalogVMeterScaleBar.StartValue       = 10.0F; // for numerical scale only
            ccbrAnalogVMeterScaleBar.EndValue         = 15.0F; // for numerical scale only
            ccbrAnalogVMeterScaleBar.StartAngle       = 70;    //50;
            ccbrAnalogVMeterScaleBar.SweepAngle       = 70;
// major ticks
            ccbrAnalogVMeterScaleBar.MajorTickNumber          = 6; // 1 V/div, difference is 6 + 1 end tick
            ccbrAnalogVMeterScaleBar.TickMajor.EnableGradient = false;
            ccbrAnalogVMeterScaleBar.TickMajor.EnableBorder   = false;
            ccbrAnalogVMeterScaleBar.TickMajor.FillColor      = Color.Honeydew; // color of outer ring and ticks
            ccbrAnalogVMeterScaleBar.TickMajor.Height         = 15;
            ccbrAnalogVMeterScaleBar.TickMajor.Width          = 7;
            ccbrAnalogVMeterScaleBar.TickMajor.Type           = TickBase.TickType.Rectangle;
            ccbrAnalogVMeterScaleBar.TickMajor.TickPosition   = TickBase.Position.Inner;
// minor ticks
            ccbrAnalogVMeterScaleBar.MinorTicknumber          = 5; // 0.2 V/div
            ccbrAnalogVMeterScaleBar.TickMinor.EnableGradient = false;
            ccbrAnalogVMeterScaleBar.TickMinor.EnableBorder   = false;
            ccbrAnalogVMeterScaleBar.TickMinor.FillColor      = Color.White;
            ccbrAnalogVMeterScaleBar.TickMinor.TickPosition   = TickBase.Position.Inner;
// scale numeric labels
            ccbrAnalogVMeterScaleBar.TickLabel.TextDirection   = CircularLabel.Direction.Horizontal;
            ccbrAnalogVMeterScaleBar.TickLabel.OffsetFromScale = 35;
            ccbrAnalogVMeterScaleBar.TickLabel.LabelFont       = new Font(FontFamily.GenericMonospace, 12, FontStyle.Bold);
            ccbrAnalogVMeterScaleBar.TickLabel.FontColor       = Color.Black;
// add circular bar to circular frame
            cfrmAnalogVMeterDialFrm.ScaleCollection.Add(ccbrAnalogVMeterScaleBar);

// now construct circular pointer
            CircularPointer cptrAnalogVMeterPtr = new CircularPointer(cfrmAnalogVMeterDialFrm);

            cptrAnalogVMeterPtr.CapPointer.Visible           = true;
            cptrAnalogVMeterPtr.CapOnTop                     = false;
            cptrAnalogVMeterPtr.BasePointer.Length           = 150;
            cptrAnalogVMeterPtr.BasePointer.FillColor        = Color.Black;
            cptrAnalogVMeterPtr.BasePointer.PointerShapeType = Pointerbase.PointerType.Type1;
            cptrAnalogVMeterPtr.BasePointer.OffsetFromCenter = -30;
// add circ pointer to frame
            ccbrAnalogVMeterScaleBar.Pointer.Add(cptrAnalogVMeterPtr);

// construct big V label
            System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
            Stream     Vlabel_bmp_Stream          = myAssembly.GetManifestResourceStream("batt_mon_app.V.png");
            Bitmap     V_label_image = new Bitmap(Vlabel_bmp_Stream);
            Point      ptVlablePoint = new Point(cfrmAnalogVMeterDialFrm.Rect.Width / 2 - V_label_image.Width / 2 - 10, (3 * cfrmAnalogVMeterDialFrm.Rect.Height) / 4 - V_label_image.Height);
            FrameLabel fbimage       = new FrameLabel(ptVlablePoint, cfrmAnalogVMeterDialFrm);

            fbimage.BackGrdImage = V_label_image;
// add label to frame
            cfrmAnalogVMeterDialFrm.FrameLabelCollection.Add(fbimage);

#if VOLTMETERTIMER
// start voltmeter timer
            m_VMeterTimer          = new System.Windows.Forms.Timer();
            m_VMeterTimer.Interval = 100;
            m_VMeterTimer.Tick    += new EventHandler(Vmeter_timer_Funkt);
            Debug.WriteLine("Form1() bInitVoltmeter() Vmeter timer is up; rate=" + (1000 / m_VMeterTimer.Interval).ToString() + " Hz");
            m_VMeterTimer.Start();
#endif
            Debug.WriteLine("--Form1::bInitVoltmeter()=" + bRes.ToString());
            return(bRes);
        }          // end of bInitVoltmeter()