Beispiel #1
0
        private void InitRadialGauge()
        {
            // create the radial gauge
            NRadialGaugePanel radialGauge = new NRadialGaugePanel();

            radialGauge.BorderStyle         = new NEdgeBorderStyle(BorderShape.Auto);
            radialGauge.ContentAlignment    = ContentAlignment.BottomRight;
            radialGauge.Location            = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage));
            radialGauge.Size                = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(45, NRelativeUnit.ParentPercentage));
            radialGauge.InnerRadius         = new NLength(10, NGraphicsUnit.Point);
            radialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black);
            radialGauge.BoundsMode          = BoundsMode.Fit;
            radialGauge.AutoBorder          = RadialGaugeAutoBorder.RoundedOutline;

            NGlassEffectStyle glassEffect = new NGlassEffectStyle();

            glassEffect.LightDirection = 130;
            glassEffect.EdgeOffset     = new NLength(0);
            glassEffect.EdgeDepth      = new NLength(30, NRelativeUnit.ParentPercentage);
            radialGauge.PaintEffect    = glassEffect;

            nChartControl1.Panels.Add(radialGauge);

            NNeedleValueIndicator indicator1 = new NNeedleValueIndicator();

            radialGauge.Indicators.Add(indicator1);
            radialGauge.SweepAngle = 180;

            InitSections(radialGauge);
        }
Beispiel #2
0
        private void UpdateEffects()
        {
            if (m_LinearGauge == null || m_RadialGauge == null)
            {
                return;
            }

            NPaintEffectStyle paintEffect = null;

            switch (PaintEffectComboBox.SelectedIndex)
            {
            case 0:     // None
                GlassEffectGroupBox.Enabled      = false;
                GelEffectGroupBox.Enabled        = false;
                PaintEffectShapeComboBox.Enabled = false;

                break;

            case 1:     // Gel
                GlassEffectGroupBox.Enabled      = false;
                GelEffectGroupBox.Enabled        = true;
                PaintEffectShapeComboBox.Enabled = true;

                NGelEffectStyle gelEffect = new NGelEffectStyle();
                gelEffect.Shape   = (PaintEffectShape)PaintEffectShapeComboBox.SelectedIndex;
                gelEffect.Margins = new NMarginsL((float)LeftMarginUpDown.Value,
                                                  (float)TopMarginUpDown.Value,
                                                  (float)RightMarginUpDown.Value,
                                                  (float)BottomMarginUpDown.Value);

                paintEffect = gelEffect;
                break;

            case 2:     // Glass
                GlassEffectGroupBox.Enabled      = true;
                GelEffectGroupBox.Enabled        = false;
                PaintEffectShapeComboBox.Enabled = true;

                NGlassEffectStyle glassEffect = new NGlassEffectStyle();
                glassEffect.Shape          = (PaintEffectShape)PaintEffectShapeComboBox.SelectedIndex;
                glassEffect.LightSpread    = (float)SpreadUpDown.Value;
                glassEffect.LightDirection = (float)DirectionUpDown.Value;
                glassEffect.LightColor     = Color.FromArgb(200, Color.White);
                glassEffect.DarkColor      = Color.FromArgb(200, Color.Gray);

                paintEffect = glassEffect;
                break;
            }

            if (paintEffect == null)
            {
                m_LinearGauge.PaintEffect = null;
                m_RadialGauge.PaintEffect = null;
            }
            else
            {
                m_LinearGauge.PaintEffect = paintEffect;
                m_RadialGauge.PaintEffect = (NPaintEffectStyle)paintEffect.Clone();
            }

            nChartControl1.Refresh();
        }