Exemple #1
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;
        }
Exemple #2
0
        private bool bInitThermometer()
        {
            bool bRes = false;

            Debug.WriteLine("++Form1::bInitThermometer()");
// digital thermometer; format -xx.x deg C
            NumericalFrame nfrm7Seg4tIndFrame = new NumericalFrame(new Rectangle(10, 10, 140, 60));

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

            for (int i = 0; i < m_ciNumOfTemperDigits; i++)
            {
                DigitalPanel7Segment seg = new DigitalPanel7Segment(nfrm7Seg4tIndFrame);
                nfrm7Seg4tIndFrame.Indicator.Panels.Add(seg);
                seg.BackColor    = Color.Black;
                seg.MainColor    = Color.GreenYellow; // blue when below freezing, orange-yellow when above freezing
                seg.EnableBorder = false;
            }
            ;

// construct analog temperature gauge, -20C to +60C, no arrow, rotating sector with gradient color instead
// ------------------------------------------------------------------------------------------------------------------------------
            CircularFrame leftdownframe = new CircularFrame(new Point(10, 20), 200);

            this.AnalogTempBaseUI.Frame.Add(leftdownframe);
            leftdownframe.BackRenderer.CenterColor = Color.Chocolate;
            leftdownframe.BackRenderer.EndColor    = Color.CornflowerBlue;
            leftdownframe.FrameRenderer.Outline    = NextUI.Renderer.FrameRender.FrameOutline.None;
            leftdownframe.Type = CircularFrame.FrameType.HalfCircle1;
// circilar scale bar
            CircularScaleBar leftdownbar = new CircularScaleBar(leftdownframe);

            leftdownbar.FillGradientType    = NextUI.Renderer.RendererGradient.GradientType.Solid;
            leftdownbar.ScaleBarSize        = 2;
            leftdownbar.TickMajor.FillColor = Color.White;
            leftdownbar.TickMinor.FillColor = Color.Cornsilk;
            leftdownbar.StartValue          = -20.0F; // deg C
            leftdownbar.EndValue            = +60.0F; // deg C
            leftdownbar.MajorTickNumber     = 9;
            leftdownbar.SweepAngle          = 180;    // 180; //
            leftdownbar.StartAngle          = 0;
// if custom label is not supplied, then auto generated values will be used
            leftdownbar.CustomLabel               = new string[] { "-20°", "-10°", "±0°", " ", "+20°", " ", "+40°", " ", "+60°" };
            leftdownbar.TickLabel.TextDirection   = CircularLabel.Direction.Horizontal; // will place words cold and hot horizontally
            leftdownbar.TickLabel.OffsetFromScale = 32;                                 // how far away labels are positioned from scale
            leftdownbar.TickLabel.LabelFont       = new Font(FontFamily.GenericMonospace, 10, FontStyle.Bold);
            leftdownbar.TickLabel.FontColor       = Color.White;
            leftdownframe.ScaleCollection.Add(leftdownbar);
// circular range
            CircularRange leftdownrange = new CircularRange(leftdownframe);

            leftdownrange.RangePosition = RangeBase.Position.Inner;
            leftdownrange.StartWidth    = 15;
            leftdownrange.EndWidth      = 15;
            leftdownrange.StartValue    = -20.0F;
            leftdownrange.EndValue      = 0.0F;
            leftdownrange.FillColor     = Color.Red;
            leftdownrange.EndColor      = Color.LightSkyBlue;
            leftdownrange.EnableBorder  = true;
            leftdownrange.BorderColor   = Color.White;
            leftdownrange.Opaque        = 255;
            leftdownbar.Range.Add(leftdownrange);
// construct big °C label
            System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
            Stream     tlabel_bmp_Stream          = myAssembly.GetManifestResourceStream("batt_mon_app.degC.png");
            Bitmap     t_label_image = new Bitmap(tlabel_bmp_Stream);
            Point      ptVlablePoint = new Point(leftdownframe.Rect.Width / 2 - t_label_image.Width / 2, (3 * leftdownframe.Rect.Height) / 4 - 2 * t_label_image.Height);
            FrameLabel fbimage       = new FrameLabel(ptVlablePoint, leftdownframe);

            fbimage.BackGrdImage = t_label_image;
// add label to frame
            leftdownframe.FrameLabelCollection.Add(fbimage);

            Debug.WriteLine("--Form1::bInitThermometer()=" + bRes.ToString());
            return(bRes);
        }
Exemple #3
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;
        }
Exemple #4
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);
        }
Exemple #5
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()