The example demonstrates how to create range and marker gauge indicators.

| Language: C# |
using Nevron.Nov;
using Nevron.Nov.Chart;
using Nevron.Nov.Dom;
using Nevron.Nov.Graphics;
using Nevron.Nov.Layout;
using Nevron.Nov.UI;
using Nevron.Nov.Windows.Forms;
using System.Windows.Forms;
namespace NovWinFormsProject
{
public partial class Form1 : Form
{
#region Constructors
public Form1()
{
InitializeComponent();
// Set form title
Text = "NOV WinForms - NLinearGaugeIndicatorsExample";
// Create the NOV example and its controls
NWidget exampleContent = CreateExampleContent();
NWidget exampleControls = CreateExampleControls();
if (exampleControls != null)
{
exampleControls.PreferredWidth = 300;
}
// Place the example and its controls in a pair box
NPairBox pairBox = new NPairBox(exampleContent, exampleControls);
pairBox.FillMode = ENStackFillMode.First;
pairBox.FitMode = ENStackFitMode.First;
pairBox.Margins = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);
// Host the example in the form
NNovWidgetHost host = new NNovWidgetHost(pairBox);
host.Dock = DockStyle.Fill;
Controls.Add(host);
}
#endregion
#region Example
public NWidget CreateExampleContent()
{
NStackPanel stack = new NStackPanel();
stack.HorizontalPlacement = ENHorizontalPlacement.Left;
// create a linear gauge
m_LinearGauge = new NLinearGauge();
stack.Add(m_LinearGauge);
m_LinearGauge.CapEffect = new NGelCapEffect();
m_LinearGauge.Border = CreateBorder();
m_LinearGauge.Padding = new NMargins(20);
m_LinearGauge.BorderThickness = new NMargins(6);
m_LinearGauge.BackgroundFill = new NStockGradientFill(NColor.Gray, NColor.Black);
m_LinearGauge.PreferredSize = new NSize(400, 150);
m_LinearGauge.Axes.Clear();
NRange celsiusRange = new NRange(-40.0, 60.0);
// add celsius and farenheit axes
NGaugeAxis celsiusAxis = new NGaugeAxis();
celsiusAxis.Range = celsiusRange;
celsiusAxis.Anchor = new NModelGaugeAxisAnchor(-5, ENVerticalAlignment.Center, ENScaleOrientation.Left, 0.0f, 100.0f);
//celsiusAxis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top);
m_LinearGauge.Axes.Add(celsiusAxis);
NGaugeAxis farenheitAxis = new NGaugeAxis();
farenheitAxis.Range = new NRange(CelsiusToFarenheit(celsiusRange.Begin), CelsiusToFarenheit(celsiusRange.End));
farenheitAxis.Anchor = new NModelGaugeAxisAnchor(5, ENVerticalAlignment.Center, ENScaleOrientation.Right, 0.0f, 100.0f);
//farenheitAxis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Bottom);
m_LinearGauge.Axes.Add(farenheitAxis);
// configure the scales
NLinearScale celsiusScale = (NLinearScale)celsiusAxis.Scale;
ConfigureScale(celsiusScale, "°C");
celsiusScale.Sections.Add(CreateSection(NColor.Red, NColor.Red, new NRange(40, 60)));
celsiusScale.Sections.Add(CreateSection(NColor.Blue, NColor.SkyBlue, new NRange(-40, -20)));
NLinearScale farenheitScale = (NLinearScale)farenheitAxis.Scale;
ConfigureScale(farenheitScale, "°F");
farenheitScale.Sections.Add(CreateSection(NColor.Red, NColor.Red, new NRange(CelsiusToFarenheit(40), CelsiusToFarenheit(60))));
farenheitScale.Sections.Add(CreateSection(NColor.Blue, NColor.SkyBlue, new NRange(CelsiusToFarenheit(-40), CelsiusToFarenheit(-20))));
// now add two indicators
m_Indicator1 = new NRangeIndicator();
m_Indicator1.Value = 10;
m_Indicator1.Stroke.Color = NColor.DarkBlue;
m_Indicator1.Fill = new NStockGradientFill(ENGradientStyle.Vertical, ENGradientVariant.Variant1, NColor.LightBlue, NColor.Blue);
m_Indicator1.BeginWidth = 10;
m_Indicator1.EndWidth = 10;
m_LinearGauge.Indicators.Add(m_Indicator1);
m_Indicator2 = new NMarkerValueIndicator();
m_Indicator2.Value = 33;
// m_Indicator2.ShapFillStyle = new NStockGradientFill(ENGradientStyle.Horizontal, ENGradientVariant.Variant1, NColor.White, NColor.Red);
// m_Indicator2.Shape.StrokeStyle.Color = Color.DarkRed;
m_LinearGauge.Indicators.Add(m_Indicator2);
return stack;
}
public NWidget CreateExampleControls()
{
NStackPanel stack = new NStackPanel();
NStackPanel propertyStack = new NStackPanel();
stack.Add(new NUniSizeBoxGroup(propertyStack));
m_RangeIndicatorValueUpDown = new NNumericUpDown();
propertyStack.Add(new NPairBox("Range Indicator Value:", m_RangeIndicatorValueUpDown, true));
m_RangeIndicatorValueUpDown.Value = m_Indicator1.Value;
m_RangeIndicatorValueUpDown.ValueChanged += OnRangeIndicatorValueUpDownValueChanged;
m_RangeIndicatorOriginModeComboBox = new NComboBox();
propertyStack.Add(new NPairBox("Range Indicator Origin Mode:", m_RangeIndicatorOriginModeComboBox, true));
m_RangeIndicatorOriginModeComboBox.Items.FillFromEnum();
m_RangeIndicatorOriginModeComboBox.SelectedIndex = (int)ENRangeIndicatorOriginMode.ScaleMin;
m_RangeIndicatorOriginModeComboBox.SelectedIndexChanged +=OnRangeIndicatorOriginModeComboBoxSelectedIndexChanged;
m_RangeIndicatorOriginUpDown = new NNumericUpDown();
m_RangeIndicatorOriginUpDown.Value = 0.0;
m_RangeIndicatorOriginUpDown.Enabled = false;
propertyStack.Add(new NPairBox("Range Indicator Origin:", m_RangeIndicatorOriginUpDown, true));
m_RangeIndicatorOriginUpDown.ValueChanged += OnRangeIndicatorOriginUpDownValueChanged;
m_ValueIndicatorUpDown = new NNumericUpDown();
propertyStack.Add(new NPairBox("Value Indicator Value:", m_ValueIndicatorUpDown, true));
m_ValueIndicatorUpDown.Value = m_Indicator2.Value;
m_ValueIndicatorUpDown.ValueChanged += OnValueIndicatorUpDownValueChanged;
m_ValueIndicatorShapeComboBox = new NComboBox();
propertyStack.Add(new NPairBox("Value Indicator Shape", m_ValueIndicatorShapeComboBox, true));
m_ValueIndicatorShapeComboBox.Items.FillFromEnum();
m_ValueIndicatorShapeComboBox.SelectedIndex = (int)m_Indicator2.Shape;
m_ValueIndicatorShapeComboBox.SelectedIndexChanged += OnValueIndicatorShapeComboBoxSelectedIndexChanged;
m_GaugeOrientationCombo = new NComboBox();
propertyStack.Add(new NPairBox("Gauge Orientation:", m_GaugeOrientationCombo, true));
m_GaugeOrientationCombo.Items.FillFromEnum();
m_GaugeOrientationCombo.SelectedIndex = (int)ENLinearGaugeOrientation.Horizontal;
m_GaugeOrientationCombo.SelectedIndexChanged += OnGaugeOrientationComboSelectedIndexChanged;
m_MarkerWidthUpDown = new NNumericUpDown();
propertyStack.Add(new NPairBox("Marker Width:", m_MarkerWidthUpDown, true));
m_MarkerWidthUpDown.Value = m_Indicator2.Width;
m_MarkerHeightUpDown = new NNumericUpDown();
propertyStack.Add(new NPairBox("Marker Height:", m_MarkerHeightUpDown, true));
m_MarkerHeightUpDown.Value = m_Indicator2.Height;
return stack;
}
public string GetExampleDescription()
{
return @"The example demonstrates how to create range and marker gauge indicators.
";
}
///
/// Gets the relevant documentation links for the example
///
///
public (string Name, string Url)[] GetDocumentationUrls()
{
return new[]
{
("Gauges Indicators Overview", "https://www.nevron.com/docs/openvision/gauges-indicators-overview.html"),
("Gauges Needle Indicator", "https://www.nevron.com/docs/openvision/gauges-needle-indicator.html"),
("Gauges Range Indicator", "https://www.nevron.com/docs/openvision/gauges-range-indicator.html"),
("Gauges Marker Indicator", "https://www.nevron.com/docs/openvision/gauges-marker-indicator.html"),
("Gauges Knob Indicator", "https://www.nevron.com/docs/openvision/gauges-knob-indicator.html"),
};
}
#endregion
#region Implementation
private NScaleSection CreateSection(NColor tickColor, NColor labelColor, NRange range)
{
NScaleSection scaleSection = new NScaleSection();
scaleSection.Range = range;
scaleSection.MajorTickFill = new NColorFill(tickColor);
NTextStyle labelStyle = new NTextStyle();
labelStyle.Fill = new NColorFill(labelColor);
labelStyle.Font = new NFont("Arimo", 12, ENFontStyle.Bold);
scaleSection.LabelTextStyle = labelStyle;
return scaleSection;
}
private void ConfigureScale(NLinearScale scale, string text)
{
scale.SetPredefinedScale(ENPredefinedScaleStyle.PresentationNoStroke);
scale.Labels.Style.TextStyle.Font = new NFont("Arimo", 12.0, ENFontStyle.Bold);
scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.White);
scale.Labels.Style.Angle = new NScaleLabelAngle(ENScaleLabelAngleMode.Scale, 90);
scale.MinorTickCount = 4;
scale.Ruler.Stroke.Width = 0;
scale.Ruler.Fill = new NColorFill(NColor.FromColor(NColor.DarkGray, 0.4f));
scale.Title.RulerAlignment = ENHorizontalAlignment.Left;
scale.Title.Text = text;
scale.Title.Angle = new NScaleLabelAngle(ENScaleLabelAngleMode.View, 0);
scale.Title.Offset = 0.0;
scale.Title.TextStyle.Font.Size = 12;
scale.Title.TextStyle.Font.Style = ENFontStyle.Bold;
scale.Title.TextStyle.Fill = new NStockGradientFill(NColor.White, NColor.LightBlue);
scale.InflateViewRangeBegin = false;
scale.InflateViewRangeEnd = false;
}
static double FarenheitToCelsius(double farenheit)
{
return (farenheit - 32.0) * 5.0 / 9.0;
}
static double CelsiusToFarenheit(double celsius)
{
return (celsius * 9.0) / 5.0 + 32.0f;
}
#endregion
#region Event Handlers
void OnRangeIndicatorOriginModeComboBoxSelectedIndexChanged(NValueChangeEventArgs arg)
{
m_Indicator1.OriginMode = (ENRangeIndicatorOriginMode)m_RangeIndicatorOriginModeComboBox.SelectedIndex;
if (m_Indicator1.OriginMode != ENRangeIndicatorOriginMode.Custom)
{
m_RangeIndicatorOriginUpDown.Enabled = false;
}
else
{
m_RangeIndicatorOriginUpDown.Enabled = true;
}
}
void OnGaugeOrientationComboSelectedIndexChanged(NValueChangeEventArgs arg)
{
m_LinearGauge.Orientation = (ENLinearGaugeOrientation)m_GaugeOrientationCombo.SelectedIndex;
if (m_LinearGauge.Orientation == ENLinearGaugeOrientation.Horizontal)
{
m_LinearGauge.PreferredSize = new NSize(400, 150);
m_LinearGauge.Padding = new NMargins(20, 0, 10, 0);
}
else
{
m_LinearGauge.PreferredSize = new NSize(150, 400);
m_LinearGauge.Padding = new NMargins(0, 10, 0, 20);
}
}
void OnValueIndicatorUpDownValueChanged(NValueChangeEventArgs arg)
{
m_Indicator2.Value = m_ValueIndicatorUpDown.Value;
}
void OnRangeIndicatorValueUpDownValueChanged(NValueChangeEventArgs arg)
{
m_Indicator1.Value = m_RangeIndicatorValueUpDown.Value;
}
void OnRangeIndicatorOriginUpDownValueChanged(NValueChangeEventArgs arg)
{
m_Indicator1.Origin = m_RangeIndicatorOriginUpDown.Value;
}
void OnValueIndicatorShapeComboBoxSelectedIndexChanged(NValueChangeEventArgs arg)
{
m_Indicator2.Shape = (ENScaleValueMarkerShape)m_ValueIndicatorShapeComboBox.SelectedIndex;
}
private void ShowMarkerEditorButton_Click(object sender, System.EventArgs e)
{
}
private void MarkerWidthUpDown_ValueChanged(object sender, System.EventArgs e)
{
m_Indicator2.Width = m_MarkerWidthUpDown.Value;
}
private void MarkerHeightUpDown_ValueChanged(object sender, System.EventArgs e)
{
m_Indicator2.Height = m_MarkerHeightUpDown.Value;
}
#endregion
#region Fields
NLinearGauge m_LinearGauge;
NRangeIndicator m_Indicator1;
NMarkerValueIndicator m_Indicator2;
NNumericUpDown m_RangeIndicatorValueUpDown;
NNumericUpDown m_RangeIndicatorOriginUpDown;
NNumericUpDown m_ValueIndicatorUpDown;
NComboBox m_RangeIndicatorOriginModeComboBox;
NComboBox m_ValueIndicatorShapeComboBox;
NComboBox m_GaugeOrientationCombo;
NNumericUpDown m_MarkerWidthUpDown;
NNumericUpDown m_MarkerHeightUpDown;
#endregion
#region Static Methods
protected NBorder CreateBorder()
{
return NBorder.CreateThreeColorBorder(NColor.LightGray, NColor.White, NColor.DarkGray, 10, 10);
}
#endregion
#region Constants
#endregion
#region Nested Types
#endregion
}
} | Language: VB.NET |
Imports Nevron.Nov
Imports Nevron.Nov.Chart
Imports Nevron.Nov.Dom
Imports Nevron.Nov.Graphics
Imports Nevron.Nov.Layout
Imports Nevron.Nov.UI
Imports Nevron.Nov.Windows.Wpf
Class MainWindow
#Region "Constructors"
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
' Set form title
Title = "NOV WPF - NLinearGaugeIndicatorsExample"
' Create the NOV example and its controls
Dim exampleContent As NWidget = CreateExampleContent()
Dim exampleControls As NWidget = CreateExampleControls()
If Not exampleControls Is Nothing Then
exampleControls.PreferredWidth = 300
End If
' Place the example and its controls in a pair box
Dim pairBox As NPairBox = New NPairBox(exampleContent, exampleControls)
pairBox.FillMode = ENStackFillMode.First
pairBox.FitMode = ENStackFitMode.First
pairBox.Margins = New NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing)
' Host the example in the form
Dim host As NNovWidgetHost(Of NWidget) = New NNovWidgetHost(Of NWidget)(pairBox)
Content = host
End Sub
#End Region
#Region "Example"
Public Function CreateExampleContent() As NWidget
Dim stack As NStackPanel = New NStackPanel()
stack.HorizontalPlacement = ENHorizontalPlacement.Left
' create a linear gauge
m_LinearGauge = New NLinearGauge()
stack.Add(m_LinearGauge)
m_LinearGauge.CapEffect = New NGelCapEffect()
m_LinearGauge.Border = CreateBorder()
m_LinearGauge.Padding = New NMargins(20)
m_LinearGauge.BorderThickness = New NMargins(6)
m_LinearGauge.BackgroundFill = New NStockGradientFill(NColor.Gray, NColor.Black)
m_LinearGauge.PreferredSize = New NSize(400, 150)
m_LinearGauge.Axes.Clear()
Dim celsiusRange As NRange = New NRange(-40.0, 60.0)
' add celsius and farenheit axes
Dim celsiusAxis As NGaugeAxis = New NGaugeAxis()
celsiusAxis.Range = celsiusRange
celsiusAxis.Anchor = New NModelGaugeAxisAnchor(-5, ENVerticalAlignment.Center, ENScaleOrientation.Left, 0.0F, 100.0F)
'celsiusAxis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Top);
m_LinearGauge.Axes.Add(celsiusAxis)
Dim farenheitAxis As NGaugeAxis = New NGaugeAxis()
farenheitAxis.Range = New NRange(CelsiusToFarenheit(celsiusRange.Begin), CelsiusToFarenheit(celsiusRange.End))
farenheitAxis.Anchor = New NModelGaugeAxisAnchor(5, ENVerticalAlignment.Center, ENScaleOrientation.Right, 0.0F, 100.0F)
'farenheitAxis.Anchor = new NDockGaugeAxisAnchor(ENGaugeAxisDockZone.Bottom);
m_LinearGauge.Axes.Add(farenheitAxis)
' configure the scales
Dim celsiusScale = CType(celsiusAxis.Scale, NLinearScale)
ConfigureScale(celsiusScale, "°C")
celsiusScale.Sections.Add(CreateSection(NColor.Red, NColor.Red, New NRange(40, 60)))
celsiusScale.Sections.Add(CreateSection(NColor.Blue, NColor.SkyBlue, New NRange(-40, -20)))
Dim farenheitScale = CType(farenheitAxis.Scale, NLinearScale)
ConfigureScale(farenheitScale, "°F")
farenheitScale.Sections.Add(CreateSection(NColor.Red, NColor.Red, New NRange(CelsiusToFarenheit(40), CelsiusToFarenheit(60))))
farenheitScale.Sections.Add(CreateSection(NColor.Blue, NColor.SkyBlue, New NRange(CelsiusToFarenheit(-40), CelsiusToFarenheit(-20))))
' now add two indicators
m_Indicator1 = New NRangeIndicator()
m_Indicator1.Value = 10
m_Indicator1.Stroke.Color = NColor.DarkBlue
m_Indicator1.Fill = New NStockGradientFill(ENGradientStyle.Vertical, ENGradientVariant.Variant1, NColor.LightBlue, NColor.Blue)
m_Indicator1.BeginWidth = 10
m_Indicator1.EndWidth = 10
m_LinearGauge.Indicators.Add(m_Indicator1)
m_Indicator2 = New NMarkerValueIndicator()
m_Indicator2.Value = 33
' m_Indicator2.ShapFillStyle = new NStockGradientFill(ENGradientStyle.Horizontal, ENGradientVariant.Variant1, NColor.White, NColor.Red);
' m_Indicator2.Shape.StrokeStyle.Color = Color.DarkRed;
m_LinearGauge.Indicators.Add(m_Indicator2)
Return stack
End Function
Public Function CreateExampleControls() As NWidget
Dim stack As NStackPanel = New NStackPanel()
Dim propertyStack As NStackPanel = New NStackPanel()
stack.Add(New NUniSizeBoxGroup(propertyStack))
m_RangeIndicatorValueUpDown = New NNumericUpDown()
propertyStack.Add(New NPairBox("Range Indicator Value:", m_RangeIndicatorValueUpDown, True))
m_RangeIndicatorValueUpDown.Value = m_Indicator1.Value
Me.m_RangeIndicatorValueUpDown.ValueChanged += AddressOf OnRangeIndicatorValueUpDownValueChanged
m_RangeIndicatorOriginModeComboBox = New NComboBox()
propertyStack.Add(New NPairBox("Range Indicator Origin Mode:", m_RangeIndicatorOriginModeComboBox, True))
m_RangeIndicatorOriginModeComboBox.Items.FillFromEnum(Of ENRangeIndicatorOriginMode)()
m_RangeIndicatorOriginModeComboBox.SelectedIndex = CInt(ENRangeIndicatorOriginMode.ScaleMin)
Me.m_RangeIndicatorOriginModeComboBox.SelectedIndexChanged += AddressOf OnRangeIndicatorOriginModeComboBoxSelectedIndexChanged
m_RangeIndicatorOriginUpDown = New NNumericUpDown()
m_RangeIndicatorOriginUpDown.Value = 0.0
m_RangeIndicatorOriginUpDown.Enabled = False
propertyStack.Add(New NPairBox("Range Indicator Origin:", m_RangeIndicatorOriginUpDown, True))
Me.m_RangeIndicatorOriginUpDown.ValueChanged += AddressOf OnRangeIndicatorOriginUpDownValueChanged
m_ValueIndicatorUpDown = New NNumericUpDown()
propertyStack.Add(New NPairBox("Value Indicator Value:", m_ValueIndicatorUpDown, True))
m_ValueIndicatorUpDown.Value = m_Indicator2.Value
Me.m_ValueIndicatorUpDown.ValueChanged += AddressOf OnValueIndicatorUpDownValueChanged
m_ValueIndicatorShapeComboBox = New NComboBox()
propertyStack.Add(New NPairBox("Value Indicator Shape", m_ValueIndicatorShapeComboBox, True))
m_ValueIndicatorShapeComboBox.Items.FillFromEnum(Of ENScaleValueMarkerShape)()
m_ValueIndicatorShapeComboBox.SelectedIndex = m_Indicator2.Shape
Me.m_ValueIndicatorShapeComboBox.SelectedIndexChanged += AddressOf OnValueIndicatorShapeComboBoxSelectedIndexChanged
m_GaugeOrientationCombo = New NComboBox()
propertyStack.Add(New NPairBox("Gauge Orientation:", m_GaugeOrientationCombo, True))
m_GaugeOrientationCombo.Items.FillFromEnum(Of ENLinearGaugeOrientation)()
m_GaugeOrientationCombo.SelectedIndex = CInt(ENLinearGaugeOrientation.Horizontal)
Me.m_GaugeOrientationCombo.SelectedIndexChanged += AddressOf OnGaugeOrientationComboSelectedIndexChanged
m_MarkerWidthUpDown = New NNumericUpDown()
propertyStack.Add(New NPairBox("Marker Width:", m_MarkerWidthUpDown, True))
m_MarkerWidthUpDown.Value = m_Indicator2.Width
m_MarkerHeightUpDown = New NNumericUpDown()
propertyStack.Add(New NPairBox("Marker Height:", m_MarkerHeightUpDown, True))
m_MarkerHeightUpDown.Value = m_Indicator2.Height
Return stack
End Function
Public Function GetExampleDescription() As String
Return "The example demonstrates how to create range and marker gauge indicators.
"
End Function
'''
''' Gets the relevant documentation links for the example
'''
'''
Public Function GetDocumentationUrls() As (String, String)()
Return {("Gauges Indicators Overview", "https://www.nevron.com/docs/openvision/gauges-indicators-overview.html"), ("Gauges Needle Indicator", "https://www.nevron.com/docs/openvision/gauges-needle-indicator.html"), ("Gauges Range Indicator", "https://www.nevron.com/docs/openvision/gauges-range-indicator.html"), ("Gauges Marker Indicator", "https://www.nevron.com/docs/openvision/gauges-marker-indicator.html"), ("Gauges Knob Indicator", "https://www.nevron.com/docs/openvision/gauges-knob-indicator.html")}
End Function
#End Region
#Region "Implementation"
Private Function CreateSection(tickColor As NColor, labelColor As NColor, range As NRange) As NScaleSection
Dim scaleSection As NScaleSection = New NScaleSection()
scaleSection.Range = range
scaleSection.MajorTickFill = New NColorFill(tickColor)
Dim labelStyle As NTextStyle = New NTextStyle()
labelStyle.Fill = New NColorFill(labelColor)
labelStyle.Font = New NFont("Arimo", 12, ENFontStyle.Bold)
scaleSection.LabelTextStyle = labelStyle
Return scaleSection
End Function
Private Sub ConfigureScale(scale As NLinearScale, text As String)
scale.SetPredefinedScale(ENPredefinedScaleStyle.PresentationNoStroke)
scale.Labels.Style.TextStyle.Font = New NFont("Arimo", 12.0, ENFontStyle.Bold)
scale.Labels.Style.TextStyle.Fill = New NColorFill(NColor.White)
scale.Labels.Style.Angle = New NScaleLabelAngle(ENScaleLabelAngleMode.Scale, 90)
scale.MinorTickCount = 4
scale.Ruler.Stroke.Width = 0
scale.Ruler.Fill = New NColorFill(NColor.FromColor(NColor.DarkGray, 0.4F))
scale.Title.RulerAlignment = ENHorizontalAlignment.Left
scale.Title.Text = text
scale.Title.Angle = New NScaleLabelAngle(ENScaleLabelAngleMode.View, 0)
scale.Title.Offset = 0.0
scale.Title.TextStyle.Font.Size = 12
scale.Title.TextStyle.Font.Style = ENFontStyle.Bold
scale.Title.TextStyle.Fill = New NStockGradientFill(NColor.White, NColor.LightBlue)
scale.InflateViewRangeBegin = False
scale.InflateViewRangeEnd = False
End Sub
Private Shared Function FarenheitToCelsius(farenheit As Double) As Double
Return (farenheit - 32.0) * 5.0 / 9.0
End Function
Private Shared Function CelsiusToFarenheit(celsius As Double) As Double
Return celsius * 9.0 / 5.0 + 32.0F
End Function
#End Region
#Region "Event Handlers"
Private Sub OnRangeIndicatorOriginModeComboBoxSelectedIndexChanged(arg As NValueChangeEventArgs)
m_Indicator1.OriginMode = CType(m_RangeIndicatorOriginModeComboBox.SelectedIndex, ENRangeIndicatorOriginMode)
If m_Indicator1.OriginMode IsNot ENRangeIndicatorOriginMode.Custom Then
m_RangeIndicatorOriginUpDown.Enabled = False
Else
m_RangeIndicatorOriginUpDown.Enabled = True
End If
End Sub
Private Sub OnGaugeOrientationComboSelectedIndexChanged(arg As NValueChangeEventArgs)
m_LinearGauge.Orientation = CType(m_GaugeOrientationCombo.SelectedIndex, ENLinearGaugeOrientation)
If m_LinearGauge.Orientation Is ENLinearGaugeOrientation.Horizontal Then
m_LinearGauge.PreferredSize = New NSize(400, 150)
m_LinearGauge.Padding = New NMargins(20, 0, 10, 0)
Else
m_LinearGauge.PreferredSize = New NSize(150, 400)
m_LinearGauge.Padding = New NMargins(0, 10, 0, 20)
End If
End Sub
Private Sub OnValueIndicatorUpDownValueChanged(arg As NValueChangeEventArgs)
m_Indicator2.Value = m_ValueIndicatorUpDown.Value
End Sub
Private Sub OnRangeIndicatorValueUpDownValueChanged(arg As NValueChangeEventArgs)
m_Indicator1.Value = m_RangeIndicatorValueUpDown.Value
End Sub
Private Sub OnRangeIndicatorOriginUpDownValueChanged(arg As NValueChangeEventArgs)
m_Indicator1.Origin = m_RangeIndicatorOriginUpDown.Value
End Sub
Private Sub OnValueIndicatorShapeComboBoxSelectedIndexChanged(arg As NValueChangeEventArgs)
m_Indicator2.Shape = CType(m_ValueIndicatorShapeComboBox.SelectedIndex, ENScaleValueMarkerShape)
End Sub
Private Sub ShowMarkerEditorButton_Click(sender As Object, e As EventArgs)
End Sub
Private Sub MarkerWidthUpDown_ValueChanged(sender As Object, e As EventArgs)
m_Indicator2.Width = m_MarkerWidthUpDown.Value
End Sub
Private Sub MarkerHeightUpDown_ValueChanged(sender As Object, e As EventArgs)
m_Indicator2.Height = m_MarkerHeightUpDown.Value
End Sub
#End Region
#Region "Fields"
Private m_LinearGauge As NLinearGauge
Private m_Indicator1 As NRangeIndicator
Private m_Indicator2 As NMarkerValueIndicator
Private m_RangeIndicatorValueUpDown As NNumericUpDown
Private m_RangeIndicatorOriginUpDown As NNumericUpDown
Private m_ValueIndicatorUpDown As NNumericUpDown
Private m_RangeIndicatorOriginModeComboBox As NComboBox
Private m_ValueIndicatorShapeComboBox As NComboBox
Private m_GaugeOrientationCombo As NComboBox
Private m_MarkerWidthUpDown As NNumericUpDown
Private m_MarkerHeightUpDown As NNumericUpDown
#End Region
#Region "Static Methods"
Protected Function CreateBorder() As NBorder
Return NBorder.CreateThreeColorBorder(NColor.LightGray, NColor.White, NColor.DarkGray, 10, 10)
End Function
#End Region
#Region "Constants"
#End Region
#Region "Nested Types"
#End Region
End Class