示例#1
0
        private NNumericLedDisplay CreateNumericLedDisplay()
        {
            NNumericLedDisplay numericLedDisplay = new NNumericLedDisplay();

            numericLedDisplay.Value          = 0.0;
            numericLedDisplay.CellCountMode  = ENDisplayCellCountMode.Fixed;
            numericLedDisplay.CellCount      = 7;
            numericLedDisplay.BackgroundFill = new NColorFill(NColor.Black);

            numericLedDisplay.Border          = NBorder.CreateSunken3DBorder(new NUIThemeColorMap(ENUIThemeScheme.WindowsClassic));
            numericLedDisplay.BorderThickness = new NMargins(6);
            numericLedDisplay.Margins         = new NMargins(5);
            numericLedDisplay.Padding         = new NMargins(5);
            numericLedDisplay.CapEffect       = new NGelCapEffect();

            return(numericLedDisplay);
        }
示例#2
0
        void OnPredefinedBorderComboSelectedIndexChanged(NValueChangeEventArgs args)
        {
            if (m_PredefinedBorderCombo.SelectedIndex == -1)
            {
                return;
            }

            double innerRadius = m_InnerRadiusCombo.SelectedIndex;
            double outerRadius = m_OuterRadiusCombo.SelectedIndex;

            // apply a predefined border
            NCustomBorderWallWidget[] elements = GetCustomBorderElements();
            for (int i = 0; i < elements.Length; i++)
            {
                NBorder border = null;
                switch (m_PredefinedBorderCombo.SelectedIndex)
                {
                case 0:     // 3D Raised Border
                    border = NBorder.CreateRaised3DBorder(new NUIThemeColorMap(ENUIThemeScheme.WindowsClassic));
                    break;

                case 1:     // 3D Sunken Border
                    border = NBorder.CreateSunken3DBorder(new NUIThemeColorMap(ENUIThemeScheme.WindowsClassic));
                    break;

                case 2:     // Filled Border
                    border = NBorder.CreateFilledBorder(NColor.Red);
                    break;

                case 3:     // Filled Border with Outlines
                    border = NBorder.CreateFilledBorder(new NColorFill(NColor.Blue), new NStroke(1, NColor.Black), new NStroke(1, NColor.Black));
                    break;
                }

                border.SetRadiuses(innerRadius, outerRadius);
                elements[i].Border = border;
            }
        }
        protected override NWidget CreateExampleContent()
        {
            NStackPanel stack = new NStackPanel();

            stack.HorizontalPlacement = Layout.ENHorizontalPlacement.Left;

            NStackPanel controlStack = new NStackPanel();

            stack.Add(controlStack);

            // create the radial gauge
            m_RadialGauge            = new NRadialGauge();
            m_RadialGauge.SweepAngle = new NAngle(270, NUnit.Degree);
            m_RadialGauge.BeginAngle = new NAngle(-225, NUnit.Degree);

            m_RadialGauge.PreferredSize = defaultRadialGaugeSize;

            m_RadialGauge.CapEffect           = new NGlassCapEffect();
            m_RadialGauge.Dial                = new NDial(ENDialShape.CutCircle, new NEdgeDialRim());
            m_RadialGauge.Dial.BackgroundFill = new NStockGradientFill(NColor.DarkGray, NColor.Black);

            // configure scale
            NGaugeAxis axis = new NGaugeAxis();

            m_RadialGauge.Axes.Add(axis);

            NLinearScale scale = (NLinearScale)axis.Scale;

            scale.SetPredefinedScale(ENPredefinedScaleStyle.Presentation);
            scale.Labels.Style.TextStyle.Font = new NFont("Arimo", 10, ENFontStyle.Bold);
            scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.White);
            scale.Labels.Style.Angle          = new NScaleLabelAngle(ENScaleLabelAngleMode.Scale, 90.0);
            scale.MinorTickCount     = 4;
            scale.Ruler.Stroke.Width = 0;
            scale.Ruler.Fill         = new NColorFill(NColor.DarkGray);

            // add radial gauge indicators
            m_ValueIndicator                 = new NNeedleValueIndicator();
            m_ValueIndicator.Fill            = new NStockGradientFill(ENGradientStyle.Horizontal, ENGradientVariant.Variant1, NColor.White, NColor.Red);
            m_ValueIndicator.Stroke.Color    = NColor.Red;
            m_ValueIndicator.Width           = 15;
            m_ValueIndicator.OffsetFromScale = -10;
            m_RadialGauge.Indicators.Add(m_ValueIndicator);

            NStackPanel verticalStack = new NStackPanel();

            verticalStack.Direction = Layout.ENHVDirection.TopToBottom;
            verticalStack.Padding   = new NMargins(80, 200, 80, 0);

            m_NumericLedDisplay = new NNumericLedDisplay();

            m_NumericLedDisplay.Value          = 0.0;
            m_NumericLedDisplay.CellCountMode  = ENDisplayCellCountMode.Fixed;
            m_NumericLedDisplay.CellCount      = 7;
            m_NumericLedDisplay.BackgroundFill = new NColorFill(NColor.Black);

            m_NumericLedDisplay.Border          = NBorder.CreateSunken3DBorder(new NUIThemeColorMap(ENUIThemeScheme.WindowsClassic));
            m_NumericLedDisplay.BorderThickness = new NMargins(6);
            m_NumericLedDisplay.Margins         = new NMargins(5);
            m_NumericLedDisplay.Padding         = new NMargins(5);
            NGelCapEffect gelCap = new NGelCapEffect();

            gelCap.Shape = ENCapEffectShape.RoundedRect;
            m_NumericLedDisplay.CapEffect       = gelCap;
            m_NumericLedDisplay.PreferredHeight = 60;

            verticalStack.Add(m_NumericLedDisplay);

            m_RadialGauge.Content = verticalStack;

            // add radial gauge
            controlStack.Add(m_RadialGauge);

            m_DataFeedTimer       = new NTimer();
            m_DataFeedTimer.Tick += new Function(OnDataFeedTimerTick);
            m_DataFeedTimer.Start();

            return(stack);
        }
示例#4
0
        protected override NWidget CreateExampleContent()
        {
            NStackPanel stack = new NStackPanel();

            stack.HorizontalPlacement = Layout.ENHorizontalPlacement.Left;

            NStackPanel controlStack = new NStackPanel();

            stack.Add(controlStack);

            // create the radial gauge
            m_RadialGauge = new NRadialGauge();

            //			radialGauge.PreferredSize = new NSize(0, 50);
            //			radialGauge.ContentAlignment = ContentAlignment.MiddleCenter;
            m_RadialGauge.SweepAngle        = new NAngle(270, NUnit.Degree);
            m_RadialGauge.BeginAngle        = new NAngle(-225, NUnit.Degree);
            m_RadialGauge.NeedleCap.Visible = false;
            m_RadialGauge.PreferredSize     = defaultRadialGaugeSize;

            // configure scale
            NGaugeAxis axis = new NGaugeAxis();

            m_RadialGauge.Axes.Add(axis);

            NStandardScale scale = (NStandardScale)axis.Scale;

            scale.SetPredefinedScale(ENPredefinedScaleStyle.PresentationNoStroke);
            scale.Labels.Style.TextStyle.Font = new NFont("Arimo", 12.0, ENFontStyle.Italic);
            scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.Black);
            scale.Labels.Style.Angle          = new NScaleLabelAngle(ENScaleLabelAngleMode.Scale, 0.0);
            scale.MinorTickCount     = 4;
            scale.Ruler.Stroke.Width = 0;
            scale.Ruler.Fill         = new NColorFill(NColor.DarkGray);

            // create the knob indicator
            m_KnobIndicator = new NKnobIndicator();
            m_KnobIndicator.OffsetFromScale = -3;
            m_KnobIndicator.AllowDragging   = true;

            // apply fill style to the marker
            NAdvancedGradientFill advancedGradientFill = new NAdvancedGradientFill();

            advancedGradientFill.BackgroundColor = NColor.Red;
            advancedGradientFill.Points.Add(new NAdvancedGradientPoint(NColor.White, new NAngle(20, NUnit.Degree), 20, 0, 100, ENAdvancedGradientPointShape.Circle));
            m_KnobIndicator.Fill          = advancedGradientFill;
            m_KnobIndicator.ValueChanged += new Function <NValueChangeEventArgs>(OnKnobValueChanged);
            m_RadialGauge.Indicators.Add(m_KnobIndicator);

            // create the numeric display
            m_NumericDisplay = new NNumericLedDisplay();

            m_NumericDisplay.PreferredSize    = new NSize(0, 60);
            m_NumericDisplay.BackgroundFill   = new NColorFill(NColor.Black);
            m_NumericDisplay.Border           = NBorder.CreateSunken3DBorder(new NUIThemeColorMap(ENUIThemeScheme.WindowsClassic));
            m_NumericDisplay.BorderThickness  = new NMargins(6);
            m_NumericDisplay.ContentAlignment = ENContentAlignment.MiddleCenter;
            m_NumericDisplay.Margins          = new NMargins(5);
            m_NumericDisplay.Padding          = new NMargins(5);
            m_NumericDisplay.CapEffect        = new NGelCapEffect();

            controlStack.Add(m_RadialGauge);
            controlStack.Add(m_NumericDisplay);

            return(stack);
        }
示例#5
0
        protected override NWidget CreateExampleContent()
        {
            // Create a table layout panel
            NTableFlowPanel table = new NTableFlowPanel();

            table.Padding           = new NMargins(10);
            table.BackgroundFill    = new NColorFill(NColor.White);
            table.MaxOrdinal        = 3;
            table.HorizontalSpacing = 10;
            table.VerticalSpacing   = 10;
            table.ColFillMode       = ENStackFillMode.Equal;
            table.ColFitMode        = ENStackFitMode.Equal;
            table.RowFitMode        = ENStackFitMode.Equal;
            table.RowFillMode       = ENStackFillMode.None;
            table.UniformWidths     = ENUniformSize.Max;
            table.UniformHeights    = ENUniformSize.Max;

            // add some predefined borders
            // 3D Borders
            NUIThemeColorMap map = new NUIThemeColorMap(ENUIThemeScheme.WindowsClassic);

            table.Add(CreateBorderedWidget("3D Border",
                                           NBorder.Create3DBorder(NColor.Green.Lighten().Lighten(), NColor.Green.Lighten(), NColor.Green.Darken(), NColor.Green)
                                           ));
            table.Add(CreateBorderedWidget("Raised Border (using Theme Colors)",
                                           NBorder.CreateRaised3DBorder(map)
                                           ));
            table.Add(CreateBorderedWidget("Sunken Border (using Theme Colors)",
                                           NBorder.CreateSunken3DBorder(map)
                                           ));

            // Filled Borders
            table.Add(CreateBorderedWidget("Solid Color",
                                           NBorder.CreateFilledBorder(NColor.Red)
                                           ));
            table.Add(CreateBorderedWidget("Solid Color With Rounded Corners",
                                           NBorder.CreateFilledBorder(NColor.Blue, 10, 13)
                                           ));
            table.Add(CreateBorderedWidget("Gradient Filling With Outline",
                                           NBorder.CreateFilledBorder(NFill.CreatePredefined(ENPredefinedFillPattern.GradientVertical, NColor.Red, NColor.Blue), new NStroke(1, NColor.Green), new NStroke(1, NColor.Green))
                                           ));

            // Outer Outline Borders
            table.Add(CreateBorderedWidget("Outer Outline Border",
                                           NBorder.CreateOuterOutlineBorder(new NStroke(1, NColor.Red, ENDashStyle.Dash))
                                           ));
            table.Add(CreateBorderedWidget("Outer Outline Border with Rounding",
                                           NBorder.CreateOuterOutlineBorder(new NStroke(1, NColor.Red, ENDashStyle.Dash), 10)
                                           ));
            table.Add(CreateBorderedWidget("Outer Outline Border",
                                           NBorder.CreateOuterOutlineBorder(new NStroke(1, NColor.Red, ENDashStyle.Dash))
                                           ));
            table.Add(CreateBorderedWidget("Outer Outline Border with Rounding",
                                           NBorder.CreateOuterOutlineBorder(new NStroke(1, NColor.Red, ENDashStyle.Dash), 10)
                                           ));

            // Inner Outline Borders
            table.Add(CreateBorderedWidget("Inner Outline Border",
                                           NBorder.CreateInnerOutlineBorder(new NStroke(1, NColor.Red, ENDashStyle.Dash))
                                           ));
            table.Add(CreateBorderedWidget("Inner Outline Border with Rounding",
                                           NBorder.CreateInnerOutlineBorder(new NStroke(1, NColor.Green, ENDashStyle.Dash), 10)
                                           ));
            table.Add(CreateBorderedWidget("Inner Outline Border",
                                           NBorder.CreateInnerOutlineBorder(new NStroke(1, NColor.Green, ENDashStyle.Dash))
                                           ));
            table.Add(CreateBorderedWidget("Inner Outline Border with Rounding",
                                           NBorder.CreateInnerOutlineBorder(new NStroke(1, NColor.Green, ENDashStyle.Dash), 10)
                                           ));

            // Double border
            table.Add(CreateBorderedWidget("Double Border",
                                           NBorder.CreateDoubleBorder(NColor.Blue)
                                           ));

            table.Add(CreateBorderedWidget("Double Border with Two Colors",
                                           NBorder.CreateDoubleBorder(NColor.Blue, NColor.Red)
                                           ));

            table.Add(CreateBorderedWidget("Double Border with Two Colors and Rounding",
                                           NBorder.CreateDoubleBorder(NColor.Blue, NColor.Red, 10, 12)
                                           ));

            // Two color borders
            table.Add(CreateBorderedWidget("Two Colors Border",
                                           NBorder.CreateTwoColorBorder(NColor.Blue, NColor.Red)
                                           ));

            table.Add(CreateBorderedWidget("Two Colors Border with Rounding",
                                           NBorder.CreateTwoColorBorder(NColor.Blue, NColor.Red, 10, 12)
                                           ));

            // Three color borders
            table.Add(CreateBorderedWidget("Three Colors Border",
                                           NBorder.CreateThreeColorBorder(NColor.Red, NColor.Green, NColor.Blue)
                                           ));

            table.Add(CreateBorderedWidget("Three Colors Border with Rounding",
                                           NBorder.CreateThreeColorBorder(NColor.Red, NColor.Green, NColor.Blue, 10, 12)
                                           ));

            return(table);
        }