public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Dragging Gauge Indicators"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); header.ContentAlignment = System.Drawing.ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); nChartControl1.Panels.Add(CreateHorizontalLinearGauge()); nChartControl1.Panels.Add(CreateVerticalLinearGauge()); nChartControl1.Panels.Add(CreateRadialGauge()); nChartControl1.Controller.Tools.Add(new NSelectorTool()); nChartControl1.Controller.Tools.Add(new NIndicatorDragTool()); // Init form controls IndicatorsSnapModeComboBox.Items.Add("None"); IndicatorsSnapModeComboBox.Items.Add("Ruler"); IndicatorsSnapModeComboBox.Items.Add("Major ticks"); IndicatorsSnapModeComboBox.Items.Add("Minor ticks"); IndicatorsSnapModeComboBox.Items.Add("Ruler Min/Max"); IndicatorsSnapModeComboBox.Items.Add("Numeric"); IndicatorsSnapModeComboBox.SelectedIndex = 0; NExampleHelpers.BindComboToItemSource(OriginNumericComboBox, 0, 20, 1); OriginNumericComboBox.SelectedItem = 0; NExampleHelpers.BindComboToItemSource(StepNumericComboBox, 1, 20, 1); StepNumericComboBox.SelectedItem = 1; }
public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Gauge Labels Orientation"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // create the radial gauge CreateRadialGauge(); // create the linear gauge CreateLinearGauge(); // update form controls NExampleHelpers.BindComboToItemSource(CustomAngleNumericComboBox, 0, 360, 10); CustomAngleNumericComboBox.SelectedItem = 0; NExampleHelpers.FillComboWithEnumValues(AngleModeComboBox, typeof(ScaleLabelAngleMode)); AngleModeComboBox.SelectedIndex = (int)ScaleLabelAngleMode.View; BeginAngleScrollBar.Value = (int)m_RadialGauge.BeginAngle; SweepAngleScrollBar.Value = (int)m_RadialGauge.SweepAngle; LinearGaugeOrientationComboBox.Items.Add("Horizontal"); LinearGaugeOrientationComboBox.Items.Add("Vertical"); LinearGaugeOrientationComboBox.SelectedIndex = 1; }
public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Gauge Axis Sections"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); NExampleHelpers.BindComboToItemSource(BlueSectionBeginComboBox, 0, 100, 5); BlueSectionBeginComboBox.SelectedItem = 0; NExampleHelpers.BindComboToItemSource(BlueSectionEndComboBox, 0, 100, 5); BlueSectionEndComboBox.SelectedItem = 20; NExampleHelpers.BindComboToItemSource(RedSectionBeginComboBox, 0, 100, 5); RedSectionBeginComboBox.SelectedItem = 80; NExampleHelpers.BindComboToItemSource(RedSectionEndComboBox, 0, 100, 5); RedSectionEndComboBox.SelectedItem = 100; // init form controls InitLinearGauge(); InitRadialGauge(); m_Timer = new DispatcherTimer(); m_Timer.Tick += m_Timer_Tick; m_Timer.Interval = new TimeSpan(100); m_Timer.Start(); }
public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Gauge Glass and Gel Effects"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // create the radial gauge CreateRadialGauge(); // create the linear gauge CreateLinearGauge(); // update form controls NExampleHelpers.BindComboToItemSource(LeftMarginComboBox, 0, 100, 5); LeftMarginComboBox.SelectedItem = 5; NExampleHelpers.BindComboToItemSource(TopMarginComboBox, 0, 100, 5); TopMarginComboBox.SelectedItem = 5; NExampleHelpers.BindComboToItemSource(RightMarginComboBox, 0, 100, 5); RightMarginComboBox.SelectedItem = 5; NExampleHelpers.BindComboToItemSource(BottomMarginComboBox, 0, 100, 5); BottomMarginComboBox.SelectedItem = 80; PaintEffectComboBox.Items.Add("None"); PaintEffectComboBox.Items.Add("Gel"); PaintEffectComboBox.Items.Add("Glass"); PaintEffectComboBox.SelectedIndex = 1; // gel PaintEffectShapeComboBox.Items.Add("Region"); PaintEffectShapeComboBox.Items.Add("Rectangle"); PaintEffectShapeComboBox.Items.Add("Ellipse"); PaintEffectShapeComboBox.Items.Add("RoundedRect"); PaintEffectShapeComboBox.SelectedIndex = 2; // ellipse BeginAngleScrollBar.Value = (int)m_RadialGauge.BeginAngle; SweepAngleScrollBar.Value = (int)m_RadialGauge.SweepAngle; NExampleHelpers.BindComboToItemSource(DirectionComboBox, 0, 180, 5); DirectionComboBox.SelectedItem = 45; NExampleHelpers.BindComboToItemSource(SpreadComboBox, -360, 360, 20); SpreadComboBox.SelectedItem = 60; LinearGaugeOrientationComboBox.Items.Add("Horizontal"); LinearGaugeOrientationComboBox.Items.Add("Vertical"); LinearGaugeOrientationComboBox.SelectedIndex = 1; }
public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Gauge Borders"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // create the radial gauge CreateRadialGauge(); // create the linear gauge CreateLinearGauge(); BeginAngleScrollBar.Value = (int)m_RadialGauge.BeginAngle; SweepAngleScrollBar.Value = (int)m_RadialGauge.SweepAngle; NExampleHelpers.BindComboToItemSource(CenterRoundingNumericComboBox, 0, 100, 5); CenterRoundingNumericComboBox.SelectedItem = 15; NExampleHelpers.BindComboToItemSource(EdgeRoundingNumericComboBox, 0, 100, 5); EdgeRoundingNumericComboBox.SelectedItem = 10; NExampleHelpers.BindComboToItemSource(RoundRectRoundingComboBox, 0, 100, 5); RoundRectRoundingComboBox.SelectedItem = 10; LinearGaugeOrientationComboBox.Items.Add("Horizontal"); LinearGaugeOrientationComboBox.Items.Add("Vertical"); LinearGaugeOrientationComboBox.SelectedIndex = 1; BorderTypeComboBox.Items.Add("Rectangular"); BorderTypeComboBox.Items.Add("Rounded Rectangular"); BorderTypeComboBox.Items.Add("Auto"); BorderTypeComboBox.SelectedIndex = 2; RadialGaugeAutoBorderTypeComboBox.Items.Add("Circle"); RadialGaugeAutoBorderTypeComboBox.Items.Add("Cut Circle"); RadialGaugeAutoBorderTypeComboBox.Items.Add("Rounded Outline"); RadialGaugeAutoBorderTypeComboBox.SelectedIndex = 0; }
public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Gauge Background Adorner"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // create the radial gauge CreateRadialGauge(); // create the linear gauge CreateLinearGauge(); // update form controls NExampleHelpers.BindComboToItemSource(LeftMarginComboBox, 0, 100, 5); LeftMarginComboBox.SelectedItem = 0; NExampleHelpers.BindComboToItemSource(TopMarginComboBox, 0, 100, 5); TopMarginComboBox.SelectedItem = 55; NExampleHelpers.BindComboToItemSource(RightMarginComboBox, 0, 100, 5); RightMarginComboBox.SelectedItem = 0; NExampleHelpers.BindComboToItemSource(BottomMarginComboBox, 0, 100, 5); BottomMarginComboBox.SelectedItem = 0; NExampleHelpers.FillComboWithEnumValues(AdornerShapeComboBox, typeof(GaugeBackroundAdornerShape)); AdornerShapeComboBox.SelectedIndex = 0; LinearGaugeOrientationComboBox.Items.Add("Horizontal"); LinearGaugeOrientationComboBox.Items.Add("Vertical"); LinearGaugeOrientationComboBox.SelectedIndex = 1; }
public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Radial Gauge Indicators"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); // create the radial gauge m_RadialGauge = new NRadialGaugePanel(); m_RadialGauge.PaintEffect = new NGlassEffectStyle(); m_RadialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); m_RadialGauge.ContentAlignment = ContentAlignment.MiddleCenter; m_RadialGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(55, NRelativeUnit.ParentPercentage)); m_RadialGauge.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black); // configure scale NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation); scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 12, System.Drawing.FontStyle.Bold); scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White); scale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90); scale.MinorTickCount = 4; scale.RulerStyle.BorderStyle.Width = new NLength(0); scale.RulerStyle.FillStyle = new NColorFillStyle(Color.DarkGray); // add radial gauge indicators m_Indicator1 = new NRangeIndicator(); m_Indicator1.Value = 20; m_Indicator1.FillStyle = new NGradientFillStyle(GradientStyle.StartToEnd, GradientVariant.Variant1, Color.Yellow, Color.Red); m_Indicator1.StrokeStyle.Color = Color.DarkBlue; m_Indicator1.EndWidth = new NLength(20); m_RadialGauge.Indicators.Add(m_Indicator1); m_Indicator2 = new NNeedleValueIndicator(); m_Indicator2.Value = 79; m_Indicator2.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); m_Indicator2.Shape.StrokeStyle.Color = Color.Red; m_RadialGauge.Indicators.Add(m_Indicator2); m_RadialGauge.SweepAngle = 270; // add radial gauge nChartControl1.Panels.Add(m_RadialGauge); // create and configure a numeric display attached to the radial gauge m_NumericDisplay = new NNumericDisplayPanel(); m_NumericDisplay.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); m_NumericDisplay.ContentAlignment = ContentAlignment.TopCenter; m_NumericDisplay.SegmentWidth = new NLength(2, NGraphicsUnit.Point); m_NumericDisplay.SegmentGap = new NLength(1, NGraphicsUnit.Point); m_NumericDisplay.CellSize = new NSizeL(new NLength(15, NGraphicsUnit.Point), new NLength(30, NGraphicsUnit.Point)); m_NumericDisplay.DecimalCellSize = new NSizeL(new NLength(10, NGraphicsUnit.Point), new NLength(20, NGraphicsUnit.Point)); m_NumericDisplay.ShowDecimalSeparator = false; m_NumericDisplay.CellAlignment = VertAlign.Top; m_NumericDisplay.BackgroundFillStyle = new NColorFillStyle(Color.DimGray); m_NumericDisplay.LitFillStyle = new NGradientFillStyle(Color.Lime, Color.Green); m_NumericDisplay.CellCountMode = DisplayCellCountMode.Fixed; m_NumericDisplay.CellCount = 6; m_NumericDisplay.Padding = new NMarginsL(6, 3, 6, 3); m_RadialGauge.ChildPanels.Add(m_NumericDisplay); // create a sunken border around the display NEdgeBorderStyle borderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect); borderStyle.OuterBevelWidth = new NLength(0); borderStyle.MiddleBevelWidth = new NLength(0); m_NumericDisplay.BorderStyle = borderStyle; // init form controls NExampleHelpers.BindComboToItemSource(SweepAngleComboBox, -360, 360, 10); SweepAngleComboBox.SelectedItem = (int)m_RadialGauge.SweepAngle; NExampleHelpers.BindComboToItemSource(BeginAngleComboBox, -360, 360, 10); BeginAngleComboBox.SelectedItem = (int)m_RadialGauge.BeginAngle; NExampleHelpers.FillComboWithEnumValues(ValueIndicatorShapeComboBox, typeof(SmartShape1D)); ValueIndicatorShapeComboBox.SelectedIndex = (int)SmartShape1D.Arrow2; NExampleHelpers.BindComboToItemSource(ValueIndicatorComboBox, 0, 100, 1); ValueIndicatorComboBox.SelectedItem = (int)m_Indicator2.Value; NExampleHelpers.BindComboToItemSource(RangeIndicatorValueComboBox, 0, 100, 5); RangeIndicatorValueComboBox.SelectedItem = (int)m_Indicator1.Value; NExampleHelpers.FillComboWithEnumValues(RangeIndicatorOriginModeComboBox, typeof(OriginMode)); RangeIndicatorOriginModeComboBox.SelectedIndex = 0; NExampleHelpers.BindComboToItemSource(NeedleWidthComboBox, -20, 60, 5); NeedleWidthComboBox.SelectedItem = (int)m_Indicator2.Width.Value; NExampleHelpers.BindComboToItemSource(RangeIndicatorOriginComboBox, 0, 100, 5); RangeIndicatorOriginComboBox.SelectedItem = (int)m_Indicator1.Origin; }
public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Radial Gauge Knob Indicators"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); header.ContentAlignment = ContentAlignment.BottomRight; header.DockMode = PanelDockMode.Top; header.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); header.Margins = new NMarginsL(5, 5, 5, 5); nChartControl1.Panels.Add(header); NDockPanel panelContainer = new NDockPanel(); panelContainer.DockMode = PanelDockMode.Fill; // create the knob indicator NKnobIndicator knobIndicator = new NKnobIndicator(); knobIndicator.OffsetFromScale = new NLength(-5); knobIndicator.OuterRimStyle.PatternRepeatCount = 5; knobIndicator.InnerRimStyle.PatternRepeatCount = 5; //knobIndicator.InnerRimStyle.Offset = new NLength(10); // apply fill style to the marker NAdvancedGradientFillStyle advancedGradientFill = new NAdvancedGradientFillStyle(); advancedGradientFill.BackgroundColor = Color.Red; advancedGradientFill.Points.Add(new NAdvancedGradientPoint(Color.White, 20, 20, 0, 100, AGPointShape.Circle)); knobIndicator.MarkerShape.FillStyle = advancedGradientFill; knobIndicator.ValueChanged += knobIndicator_ValueChanged; m_RadialGauge = CreateRadialGauge(knobIndicator); m_NumericDisplay = CreateNumericDisplay(); panelContainer.ChildPanels.Add(m_NumericDisplay); panelContainer.ChildPanels.Add(m_RadialGauge); panelContainer.Margins = new NMarginsL(10, 10, 10, 10); nChartControl1.Panels.Add(panelContainer); nChartControl1.Controller.Tools.Add(new NSelectorTool()); nChartControl1.Controller.Tools.Add(new NIndicatorDragTool()); m_Updating = true; // Init form controls NExampleHelpers.FillComboWithEnumValues(MarkerShapeComboBox, typeof(SmartShape2D)); MarkerShapeComboBox.SelectedIndex = (int)SmartShape2D.Ellipse; NExampleHelpers.BindComboToItemSource(MarkerOffsetComboBox, -100, 100, 5); MarkerOffsetComboBox.SelectedItem = (int)knobIndicator.OffsetFromScale.Value; NExampleHelpers.FillComboWithEnumValues(MarkerPaintOrderComboBox, typeof(KnobMarkerPaintOrder)); MarkerPaintOrderComboBox.SelectedIndex = (int)knobIndicator.MarkerPaintOrder; // outer rim NExampleHelpers.FillComboWithEnumValues(OuterRimPatternComboBox, typeof(CircularRimPattern)); OuterRimPatternComboBox.SelectedIndex = (int)knobIndicator.OuterRimStyle.Pattern; NExampleHelpers.BindComboToItemSource(OuterRimPatternRepeatCountComboBox, 0, 100, 5); OuterRimPatternRepeatCountComboBox.SelectedItem = (int)knobIndicator.OuterRimStyle.PatternRepeatCount; NExampleHelpers.BindComboToItemSource(OuterRimRadiusOffsetComboBox, 0, 100, 5); OuterRimRadiusOffsetComboBox.SelectedItem = (int)knobIndicator.OuterRimStyle.Offset.Value; // inner rim NExampleHelpers.FillComboWithEnumValues(InnerRimPatternComboBox, typeof(CircularRimPattern)); InnerRimPatternComboBox.SelectedIndex = (int)knobIndicator.InnerRimStyle.Pattern; NExampleHelpers.BindComboToItemSource(InnerRimPatternRepeatCountComboBox, 0, 100, 5); InnerRimPatternRepeatCountComboBox.SelectedItem = (int)knobIndicator.InnerRimStyle.PatternRepeatCount; NExampleHelpers.BindComboToItemSource(InnerRimRadiusOffsetComboBox, 0, 100, 5); InnerRimRadiusOffsetComboBox.SelectedItem = (int)knobIndicator.InnerRimStyle.Offset.Value; m_Updating = false; OuterRimPatternRepeatCountComboBox.SelectedItem = 6; }
public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Gauge Axis Scale Appearance"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); // create the radial gauge NRadialGaugePanel radialGauge = new NRadialGaugePanel(); radialGauge.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); radialGauge.Size = new NSizeL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage)); radialGauge.BackgroundFillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Gray); radialGauge.PaintEffect = new NGlassEffectStyle(); radialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); radialGauge.PositionChildPanelsInContentBounds = true; nChartControl1.Panels.Add(radialGauge); m_Axis = (NGaugeAxis)radialGauge.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)m_Axis.ScaleConfigurator; scale.MinorTickCount = 3; NRangeIndicator indicator1 = new NRangeIndicator(); indicator1.Value = 80; indicator1.OriginMode = OriginMode.ScaleMax; indicator1.FillStyle = new NColorFillStyle(Color.Red); indicator1.StrokeStyle.Color = Color.DarkRed; radialGauge.Indicators.Add(indicator1); NNeedleValueIndicator indicator2 = new NNeedleValueIndicator(); indicator2.Value = 79; indicator2.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); indicator2.Shape.StrokeStyle.Color = Color.Red; radialGauge.Indicators.Add(indicator2); radialGauge.SweepAngle = 270; m_Updating = true; NExampleHelpers.FillComboWithEnumValues(MinorTickShapeComboBox, typeof(ScaleTickShape)); NExampleHelpers.FillComboWithEnumValues(MajorTickShapeComboBox, typeof(ScaleTickShape)); NExampleHelpers.FillComboWithEnumValues(PredefinedScaleStyleComboBox, typeof(PredefinedScaleStyle)); PredefinedScaleStyleComboBox.SelectedIndex = (int)PredefinedScaleStyle.Standard; NExampleHelpers.BindComboToItemSource(RulerOffsetComboBox, 0, 20, 1); RulerOffsetComboBox.SelectedItem = 0; NExampleHelpers.BindComboToItemSource(RulerLengthComboBox, 0, 20, 1); RulerLengthComboBox.SelectedItem = 2; NExampleHelpers.BindComboToItemSource(MajorTicksLengthComboBox, 0, 20, 1); MajorTicksLengthComboBox.SelectedItem = 3; NExampleHelpers.BindComboToItemSource(MajorTicksWidthComboBox, 0, 20, 1); MajorTicksWidthComboBox.SelectedItem = 2; NExampleHelpers.BindComboToItemSource(MajorTicksOffsetComboBox, 0, 20, 1); MajorTicksOffsetComboBox.SelectedItem = 0; NExampleHelpers.BindComboToItemSource(MinorTicksLengthComboBox, 0, 20, 1); MinorTicksLengthComboBox.SelectedItem = 3; NExampleHelpers.BindComboToItemSource(MinorTicksWidthComboBox, 0, 20, 1); MinorTicksWidthComboBox.SelectedItem = 2; NExampleHelpers.BindComboToItemSource(MinorTicksOffsetComboBox, 0, 20, 1); MinorTicksOffsetComboBox.SelectedItem = 0; m_Updating = false; InitFormControls(); }
public override void Create() { nChartControl1.Panels.Clear(); // set a chart title NLabel header = new NLabel("Linear Gauge Indicators"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); header.ContentAlignment = System.Drawing.ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); nChartControl1.Panels.Add(header); // create a linear gauge m_LinearGauge = new NLinearGaugePanel(); nChartControl1.Panels.Add(m_LinearGauge); m_LinearGauge.ContentAlignment = System.Drawing.ContentAlignment.MiddleCenter; m_LinearGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage)); m_LinearGauge.PaintEffect = new NGelEffectStyle(); m_LinearGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect); m_LinearGauge.BackgroundFillStyle = new NGradientFillStyle(System.Drawing.Color.Gray, System.Drawing.Color.Black); m_LinearGauge.Axes.Clear(); NRange1DD celsiusRange = new NRange1DD(-40, 60); // add celsius and farenheit axes NGaugeAxis celsiusAxis = new NGaugeAxis(); celsiusAxis.Range = celsiusRange; celsiusAxis.Anchor = new NModelGaugeAxisAnchor(new NLength(-5), VertAlign.Center, RulerOrientation.Left, 0, 100); m_LinearGauge.Axes.Add(celsiusAxis); NGaugeAxis farenheitAxis = new NGaugeAxis(); farenheitAxis.Range = new NRange1DD(CelsiusToFarenheit(celsiusRange.Begin), CelsiusToFarenheit(celsiusRange.End)); farenheitAxis.Anchor = new NModelGaugeAxisAnchor(new NLength(5), VertAlign.Center, RulerOrientation.Right, 0, 100); m_LinearGauge.Axes.Add(farenheitAxis); // configure the scales NLinearScaleConfigurator celsiusScale = (NLinearScaleConfigurator)celsiusAxis.ScaleConfigurator; ConfigureScale(celsiusScale, "°C"); celsiusScale.Sections.Add(CreateSection(System.Drawing.Color.Red, System.Drawing.Color.Red, new NRange1DD(40, 60))); celsiusScale.Sections.Add(CreateSection(System.Drawing.Color.Blue, System.Drawing.Color.SkyBlue, new NRange1DD(-40, -20))); NLinearScaleConfigurator farenheitScale = (NLinearScaleConfigurator)farenheitAxis.ScaleConfigurator; ConfigureScale(farenheitScale, "°F"); farenheitScale.Sections.Add(CreateSection(System.Drawing.Color.Red, System.Drawing.Color.Red, new NRange1DD(CelsiusToFarenheit(40), CelsiusToFarenheit(60)))); farenheitScale.Sections.Add(CreateSection(System.Drawing.Color.Blue, System.Drawing.Color.SkyBlue, new NRange1DD(CelsiusToFarenheit(-40), CelsiusToFarenheit(-20)))); // now add two indicators m_Indicator1 = new NRangeIndicator(); m_Indicator1.Value = 10; m_Indicator1.StrokeStyle.Color = System.Drawing.Color.DarkBlue; m_Indicator1.FillStyle = new NGradientFillStyle(GradientStyle.Vertical, GradientVariant.Variant1, System.Drawing.Color.LightBlue, System.Drawing.Color.Blue); m_LinearGauge.Indicators.Add(m_Indicator1); m_Indicator2 = new NMarkerValueIndicator(); m_Indicator2.Value = 33; m_Indicator2.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, System.Drawing.Color.White, System.Drawing.Color.Red); m_Indicator2.Shape.StrokeStyle.Color = System.Drawing.Color.DarkRed; m_LinearGauge.Indicators.Add(m_Indicator2); // init form controls NExampleHelpers.BindComboToItemSource(ValueIndicatorComboBox, -20, 60, 1); ValueIndicatorComboBox.SelectedItem = (int)m_Indicator2.Value; NExampleHelpers.BindComboToItemSource(RangeIndicatorValueComboBox, -20, 60, 1); RangeIndicatorValueComboBox.SelectedItem = (int)m_Indicator1.Value; NExampleHelpers.BindComboToItemSource(MarkerWidthComboBox, 1, 40, 1); MarkerWidthComboBox.SelectedItem = (int)m_Indicator2.Width.Value; NExampleHelpers.BindComboToItemSource(MarkerHeightComboBox, 1, 40, 1); MarkerHeightComboBox.SelectedItem = (int)m_Indicator2.Height.Value; NExampleHelpers.FillComboWithEnumValues(RangeIndicatorOriginModeComboBox, typeof(OriginMode)); RangeIndicatorOriginModeComboBox.SelectedIndex = 0; NExampleHelpers.BindComboToItemSource(RangeIndicatorOriginComboBox, -20, 60, 1); RangeIndicatorOriginComboBox.SelectedItem = (int)m_Indicator1.Origin; NExampleHelpers.FillComboWithEnumValues(ValueIndicatorShapeComboBox, typeof(SmartShape2D)); ValueIndicatorShapeComboBox.SelectedIndex = (int)SmartShape2D.Triangle; NExampleHelpers.FillComboWithEnumValues(GaugeOrientationCombo, typeof(LinearGaugeOrientation)); GaugeOrientationCombo.SelectedIndex = 0; }