Scale Tick Marks Example for WPF

Nevron NOV Gauge for WPF ships with hundreds of examples with full source code, as part of the Nevron Open Vision Suite. All WPF Gauge examples are also available as a stand-alone Visual Studio solution in C# and VB.NET, which you can download from the links below.

Scale Tick Marks Example for WPF Description

Major tick marks are the primary indicators of a gauge. Minor tick marks are secondary indicators displayed in between the major tick marks.


Scale Tick Marks Example

C# Scale Tick Marks Example Code for Nevron Gauge for WPF
Language: C#

using Nevron.Nov;
using Nevron.Nov.Chart;
using Nevron.Nov.Dom;
using Nevron.Nov.Editors;
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 - NScaleTickMarksExample";

			// 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();

            NStackPanel controlStack = new NStackPanel();
            controlStack.Direction = ENHVDirection.LeftToRight;
            stack.Add(controlStack);
           
            // create the radial gauge
            m_RadialGauge = new NRadialGauge();
            controlStack.Add(m_RadialGauge);

            m_RadialGauge.CapEffect = new NGlassCapEffect();
            m_RadialGauge.Dial = new NDial(ENDialShape.Circle, new NEdgeDialRim());
            m_RadialGauge.PreferredSize = defaultRadialGaugeSize;
            m_RadialGauge.SweepAngle = new NAngle(280, NUnit.Degree);
            m_RadialGauge.BeginAngle = new NAngle(120, NUnit.Degree);

            NAdvancedGradientFill gradientFill = new NAdvancedGradientFill();
            gradientFill.BackgroundColor = NColor.DarkBlue;
            gradientFill.Points.Add(new NAdvancedGradientPoint(NColor.DeepSkyBlue, new NAngle(10, NUnit.Degree), 0.1f, 0, 1.0f, ENAdvancedGradientPointShape.Circle));
            m_RadialGauge.Dial.BackgroundFill = gradientFill;
            m_RadialGauge.CapEffect = new NGlassCapEffect(ENCapEffectShape.Ellipse);

            m_RadialGauge.Dial.BackgroundFill = gradientFill;
            m_RadialGauge.CapEffect = new NGlassCapEffect(ENCapEffectShape.Region);

            // add axis 
            NGaugeAxis axis = new NGaugeAxis();
            m_RadialGauge.Axes.Clear();
            m_RadialGauge.Axes.Add(axis);

            // add scale
            m_Scale = (NStandardScale)axis.Scale;
            m_Scale.SetPredefinedScale(ENPredefinedScaleStyle.PresentationNoStroke);
            m_Scale.Ruler.Fill = new NColorFill(NColor.FromColor(NColor.Transparent, 0.3f));
            m_Scale.Labels.Style.TextStyle.Font = new NFont("Microsoft Sans Serif", 8, ENFontStyle.Bold);
            m_Scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.DarkOrange);
            m_Scale.MajorTickMode = ENMajorTickMode.AutoMaxCount;
            m_Scale.OuterMinorTicks.Visible = true;
            m_Scale.MinorTickCount = 5;
        
            // add needle indicators
            NNeedleValueIndicator needle = new NNeedleValueIndicator(60);
            needle.OffsetOriginMode = ENIndicatorOffsetOriginMode.ScaleMiddle;
            needle.OffsetFromScale = 15;
            m_RadialGauge.Indicators.Add(needle);

            return stack;
        }
        public NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            NStackPanel propertyStack = new NStackPanel();
            stack.Add(new NUniSizeBoxGroup(propertyStack));

            // major tick properties
            NGroupBox majorTicksGroupBox = new NGroupBox("Major Ticks");
            propertyStack.Add(majorTicksGroupBox);

            NStackPanel majorTicksGroupBoxGroupBoxContent = new NStackPanel();
            majorTicksGroupBox.Content = new NUniSizeBoxGroup(majorTicksGroupBoxGroupBoxContent);

            // minor tick properties
            NGroupBox minorTicksGroupBox = new NGroupBox("Minor Ticks");
            propertyStack.Add(minorTicksGroupBox);

            NStackPanel minorTicksGroupBoxContent = new NStackPanel();
            minorTicksGroupBox.Content = new NUniSizeBoxGroup(minorTicksGroupBoxContent);

            //  major tick visability checkbox 
            m_OuterMajorTicksVisibility = new NCheckBox("Major Tick Visible");
            m_OuterMajorTicksVisibility.Checked = true;
            m_OuterMajorTicksVisibility.CheckedChanged += OnOuterMajorTicksVisibilityCheckedChanged;
            majorTicksGroupBoxGroupBoxContent.Add(m_OuterMajorTicksVisibility);

            // major ticks placement
            m_MajorTickPlacmentComboBox = new NComboBox();
            m_MajorTickPlacmentComboBox.Items.FillFromEnum();
            m_MajorTickPlacmentComboBox.SelectedIndex = (int)m_MajorTickPlacmentComboBox.SelectedIndex;
            m_MajorTickPlacmentComboBox.SelectedIndexChanged += OnMajorTickPlacementComboBoxSelectedIndexChanged;
            majorTicksGroupBoxGroupBoxContent.Add(new NPairBox("Placement: ", m_MajorTickPlacmentComboBox, true));

            //  major ticks shape 
            m_MajorTickShapeComboBox = new NComboBox();
            m_MajorTickShapeComboBox.Items.FillFromEnum();
            m_MajorTickShapeComboBox.SelectedIndexChanged += OnMajorTickShapeComboBoxSelectedIndexChanged;
            majorTicksGroupBoxGroupBoxContent.Add(new NPairBox("Shape: ", m_MajorTickShapeComboBox, true));

            // major ticks fill color button
            m_MajorTicksFillColorButton = new NButton("Major Ticks Fill Color");
            m_MajorTicksFillColorButton.Click += OnOuterMajorTickFillButtonClick;
            majorTicksGroupBoxGroupBoxContent.Add(m_MajorTicksFillColorButton);

            // major ticks width 
            m_MajorTicksWidthUpDown = new NNumericUpDown();
            m_MajorTicksWidthUpDown.ValueChanged += OnUpDownMajorTickWidthChanged;
            m_MajorTicksWidthUpDown.Value = 5;
            //m_MajorTicksWidthUpDown.Value = Math.Min(Math.Max(m_MajorTicksWidthUpDown.Value, 2), 20);
            majorTicksGroupBoxGroupBoxContent.Add(new NPairBox("Width:",m_MajorTicksWidthUpDown, true));

            // major ticks length
            m_MajorTicskLengthUpDown = new NNumericUpDown();
            m_MajorTicksWidthUpDown.Value = 3;
            m_MajorTicskLengthUpDown.ValueChanged += OnUpDownMajorTickLengthChanged;
            majorTicksGroupBoxGroupBoxContent.Add(new NPairBox("Length:", m_MajorTicskLengthUpDown, true));

            // minor ticks visible check box
            m_MinorTicksVisability = new NCheckBox("Minor Tick Visible");
            m_MinorTicksVisability.Checked = true;
            m_MinorTicksVisability.CheckedChanged += OnMinorTicksVisibilityCheckedChanged;
            minorTicksGroupBoxContent.Add(m_MinorTicksVisability);

            // minor ticks placement
            m_MinorTickPlacmentComboBox = new NComboBox();
            m_MinorTickPlacmentComboBox.Items.FillFromEnum();
            m_MinorTickPlacmentComboBox.SelectedIndex = (int)m_MinorTickPlacmentComboBox.SelectedIndex;
            m_MinorTickPlacmentComboBox.SelectedIndexChanged += OnMinorTickPlacementComboBoxSelectedIndexChanged;
            minorTicksGroupBoxContent.Add(new NPairBox("Placement: ", m_MinorTickPlacmentComboBox, true));

            // minor ticks Shape 
            m_MinorTickShapeComboBox = new NComboBox();
            m_MinorTickShapeComboBox.Items.FillFromEnum();
            m_MinorTickShapeComboBox.SelectedIndex = (int)m_MinorTickShapeComboBox.SelectedIndex;
            m_MinorTickShapeComboBox.SelectedIndexChanged += OnMinorTickShapeComboBoxSelectedIndexChanged;
            minorTicksGroupBoxContent.Add(new NPairBox("Shape: ", m_MinorTickShapeComboBox, true));

            // minor ticks Fill
            m_MinorTicksFillColorButton = new NButton("Minor Ticks Fill Color");
            m_MinorTicksFillColorButton.Click += OnMinorTickFillButtonClick;
            minorTicksGroupBoxContent.Add(m_MinorTicksFillColorButton);
           
            // minor tick width 
            m_MinorTicskWidthUpDown = new NNumericUpDown();
            m_MinorTicskWidthUpDown.Value = 3;
            m_MinorTicskWidthUpDown.ValueChanged += OnUpDownMinorTickWidthChanged;
          //  m_MinorTicskWidthUpDown.Value = Math.Min(Math.Max(m_MinorTicskWidthUpDown.Value, 2), 20);
            minorTicksGroupBoxContent.Add(new NPairBox("Width:", m_MinorTicskWidthUpDown, true));
        
            return stack;
        }

      
        public string GetExampleDescription()
        {
            return @"

Major tick marks are the primary indicators of a gauge. Minor tick marks are secondary indicators displayed in between the major tick marks.

"; } /// /// Gets the relevant documentation links for the example /// /// public (string Name, string Url)[] GetDocumentationUrls() { return new[] { ("Scale Ticks", "https://www.nevron.com/docs/openvision/scale-ticks.html"), ("Gauges Axes", "https://www.nevron.com/docs/openvision/gauges-axes.html"), }; } #endregion #region Implementation #endregion #region Event Handlers private void OnOuterMajorTicksVisibilityCheckedChanged(NValueChangeEventArgs arg) { bool checkedValue = m_OuterMajorTicksVisibility.Checked; m_Scale.OuterMajorTicks.Visible = checkedValue; m_MajorTickShapeComboBox.Enabled = checkedValue; m_MajorTicksFillColorButton.Enabled = checkedValue; m_MajorTicksWidthUpDown.Enabled = checkedValue; m_MajorTicskLengthUpDown.Enabled = checkedValue; m_MajorTickPlacmentComboBox.Enabled = checkedValue; } private void OnMajorTickPlacementComboBoxSelectedIndexChanged(NValueChangeEventArgs arg) { ENTicksPlacement selectedPlacement = (ENTicksPlacement)m_MajorTickPlacmentComboBox.SelectedIndex; } private void OnMajorTickShapeComboBoxSelectedIndexChanged(NValueChangeEventArgs arg) { m_Scale.OuterMajorTicks.Shape = (ENScaleValueMarkerShape)m_MajorTickShapeComboBox.SelectedIndex; } private void OnOuterMajorTickFillButtonClick(NEventArgs arg) { NEditorWindow.CreateForType( (NFill)m_Scale.OuterMajorTicks.Fill.DeepClone(), null, m_Scale.OuterMajorTicks.DisplayWindow, false, OnOuterMajorTicksFillEdited).Open(); } private void OnOuterMajorTicksFillEdited(NFill fill) { m_Scale.OuterMajorTicks.Fill = (NFill)(fill.DeepClone()); } private void OnUpDownMajorTickWidthChanged(NValueChangeEventArgs arg) { double majorTickWidth = (double)arg.NewValue; if (majorTickWidth >= 2 && majorTickWidth <= 20) { m_Scale.OuterMajorTicks.Width = majorTickWidth; } else { // Revert the value change m_MajorTicksWidthUpDown.Value = m_Scale.OuterMajorTicks.Width; } } private void OnUpDownMajorTickLengthChanged(NValueChangeEventArgs arg) { double majorTickLength= (double)arg.NewValue; if (majorTickLength >= 2 && majorTickLength <= 20) { m_Scale.OuterMajorTicks.Length = majorTickLength; } else { m_MajorTicskLengthUpDown.Value = m_Scale.OuterMajorTicks.Length; } } private void OnMinorTicksVisibilityCheckedChanged(NValueChangeEventArgs arg) { bool checkedValue = m_MinorTicksVisability.Checked; m_Scale.OuterMinorTicks.Visible = checkedValue; m_MinorTickShapeComboBox.Enabled = checkedValue; m_MinorTicksFillColorButton.Enabled = checkedValue; m_MinorTicskWidthUpDown.Enabled = checkedValue; m_MajorTickPlacmentComboBox.Enabled = checkedValue; } private void OnUpDownMinorTickWidthChanged(NValueChangeEventArgs arg) { double minorTickWidth = (double)arg.NewValue; if (minorTickWidth >= 2 && minorTickWidth <= 20) { m_Scale.OuterMinorTicks.Width = minorTickWidth; } else { // Revert the value change m_MinorTicskWidthUpDown.Value = m_Scale.OuterMinorTicks.Width; } } private void OnMinorTickPlacementComboBoxSelectedIndexChanged(NValueChangeEventArgs arg) { ENTicksPlacement selectedPlacement = (ENTicksPlacement)m_MinorTickPlacmentComboBox.SelectedIndex; } private void OnMinorTickShapeComboBoxSelectedIndexChanged(NValueChangeEventArgs arg) { m_Scale.OuterMinorTicks.Shape = (ENScaleValueMarkerShape)m_MinorTickShapeComboBox.SelectedIndex; } private void OnMinorTickFillButtonClick(NEventArgs arg) { NEditorWindow.CreateForType( (NFill)m_Scale.OuterMajorTicks.Fill.DeepClone(), null, m_Scale.OuterMajorTicks.DisplayWindow, false, OnMinorTicksFillEdited).Open(); } private void OnMinorTicksFillEdited(NFill fill) { m_Scale.OuterMinorTicks.Fill = (NFill)(fill.DeepClone()); } #endregion #region Fields NRadialGauge m_RadialGauge; NStandardScale m_Scale; NCheckBox m_OuterMajorTicksVisibility; NCheckBox m_MinorTicksVisability; NComboBox m_MajorTickShapeComboBox; NComboBox m_MajorTickPlacmentComboBox; NComboBox m_MinorTickPlacmentComboBox; NComboBox m_MinorTickShapeComboBox; NNumericUpDown m_MajorTicksWidthUpDown; NNumericUpDown m_MajorTicskLengthUpDown; NNumericUpDown m_MinorTicskWidthUpDown; NButton m_MajorTicksFillColorButton; NButton m_MinorTicksFillColorButton; #endregion #region Static Methods #endregion #region Constants private static readonly NSize defaultRadialGaugeSize = new NSize(300, 300); #endregion #region Nested Types #endregion } }

Download a fully functional C# (.cs) Scale Tick Marks Example for WPF Solution

VB.NET Scale Tick Marks Example Code for Nevron Gauge for WPF
Language: VB.NET

Imports Nevron.Nov
Imports Nevron.Nov.Chart
Imports Nevron.Nov.Dom
Imports Nevron.Nov.Editors
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 - NScaleTickMarksExample"

		' 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()

            Dim controlStack As NStackPanel = New NStackPanel()
            controlStack.Direction = ENHVDirection.LeftToRight
            stack.Add(controlStack)

            ' create the radial gauge
            m_RadialGauge = New NRadialGauge()
            controlStack.Add(m_RadialGauge)

            m_RadialGauge.CapEffect = New NGlassCapEffect()
            m_RadialGauge.Dial = New NDial(ENDialShape.Circle, New NEdgeDialRim())
            m_RadialGauge.PreferredSize = defaultRadialGaugeSize
            m_RadialGauge.SweepAngle = New NAngle(280, NUnit.Degree)
            m_RadialGauge.BeginAngle = New NAngle(120, NUnit.Degree)

            Dim gradientFill As NAdvancedGradientFill = New NAdvancedGradientFill()
            gradientFill.BackgroundColor = NColor.DarkBlue
            gradientFill.Points.Add(New NAdvancedGradientPoint(NColor.DeepSkyBlue, New NAngle(10, NUnit.Degree), 0.1F, 0, 1.0F, ENAdvancedGradientPointShape.Circle))
            m_RadialGauge.Dial.BackgroundFill = gradientFill
            m_RadialGauge.CapEffect = New NGlassCapEffect(ENCapEffectShape.Ellipse)

            m_RadialGauge.Dial.BackgroundFill = gradientFill
            m_RadialGauge.CapEffect = New NGlassCapEffect(ENCapEffectShape.Region)

            ' add axis 
            Dim axis As NGaugeAxis = New NGaugeAxis()
            m_RadialGauge.Axes.Clear()
            m_RadialGauge.Axes.Add(axis)

            ' add scale
            m_Scale = CType(axis.Scale, NStandardScale)
            m_Scale.SetPredefinedScale(ENPredefinedScaleStyle.PresentationNoStroke)
            m_Scale.Ruler.Fill = New NColorFill(NColor.FromColor(NColor.Transparent, 0.3F))
            m_Scale.Labels.Style.TextStyle.Font = New NFont("Microsoft Sans Serif", 8, ENFontStyle.Bold)
            m_Scale.Labels.Style.TextStyle.Fill = New NColorFill(NColor.DarkOrange)
            m_Scale.MajorTickMode = ENMajorTickMode.AutoMaxCount
            m_Scale.OuterMinorTicks.Visible = True
            m_Scale.MinorTickCount = 5

            ' add needle indicators
            Dim needle As NNeedleValueIndicator = New NNeedleValueIndicator(60)
            needle.OffsetOriginMode = ENIndicatorOffsetOriginMode.ScaleMiddle
            needle.OffsetFromScale = 15
            m_RadialGauge.Indicators.Add(needle)

            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))

            ' major tick properties
            Dim majorTicksGroupBox As NGroupBox = New NGroupBox("Major Ticks")
            propertyStack.Add(majorTicksGroupBox)

            Dim majorTicksGroupBoxGroupBoxContent As NStackPanel = New NStackPanel()
            majorTicksGroupBox.Content = New NUniSizeBoxGroup(majorTicksGroupBoxGroupBoxContent)

            ' minor tick properties
            Dim minorTicksGroupBox As NGroupBox = New NGroupBox("Minor Ticks")
            propertyStack.Add(minorTicksGroupBox)

            Dim minorTicksGroupBoxContent As NStackPanel = New NStackPanel()
            minorTicksGroupBox.Content = New NUniSizeBoxGroup(minorTicksGroupBoxContent)

            '  major tick visability checkbox 
            m_OuterMajorTicksVisibility = New NCheckBox("Major Tick Visible")
            m_OuterMajorTicksVisibility.Checked = True
            Me.m_OuterMajorTicksVisibility.CheckedChanged += AddressOf OnOuterMajorTicksVisibilityCheckedChanged
            majorTicksGroupBoxGroupBoxContent.Add(m_OuterMajorTicksVisibility)

            ' major ticks placement
            m_MajorTickPlacmentComboBox = New NComboBox()
            m_MajorTickPlacmentComboBox.Items.FillFromEnum(Of ENTicksPlacement)()
            m_MajorTickPlacmentComboBox.SelectedIndex = m_MajorTickPlacmentComboBox.SelectedIndex
            Me.m_MajorTickPlacmentComboBox.SelectedIndexChanged += AddressOf OnMajorTickPlacementComboBoxSelectedIndexChanged
            majorTicksGroupBoxGroupBoxContent.Add(New NPairBox("Placement: ", m_MajorTickPlacmentComboBox, True))

            '  major ticks shape 
            m_MajorTickShapeComboBox = New NComboBox()
            m_MajorTickShapeComboBox.Items.FillFromEnum(Of ENScaleValueMarkerShape)()
            Me.m_MajorTickShapeComboBox.SelectedIndexChanged += AddressOf OnMajorTickShapeComboBoxSelectedIndexChanged
            majorTicksGroupBoxGroupBoxContent.Add(New NPairBox("Shape: ", m_MajorTickShapeComboBox, True))

            ' major ticks fill color button
            m_MajorTicksFillColorButton = New NButton("Major Ticks Fill Color")
            Me.m_MajorTicksFillColorButton.Click += AddressOf OnOuterMajorTickFillButtonClick
            majorTicksGroupBoxGroupBoxContent.Add(m_MajorTicksFillColorButton)

            ' major ticks width 
            m_MajorTicksWidthUpDown = New NNumericUpDown()
            Me.m_MajorTicksWidthUpDown.ValueChanged += AddressOf OnUpDownMajorTickWidthChanged
            m_MajorTicksWidthUpDown.Value = 5
            'm_MajorTicksWidthUpDown.Value = Math.Min(Math.Max(m_MajorTicksWidthUpDown.Value, 2), 20);
            majorTicksGroupBoxGroupBoxContent.Add(New NPairBox("Width:", m_MajorTicksWidthUpDown, True))

            ' major ticks length
            m_MajorTicskLengthUpDown = New NNumericUpDown()
            m_MajorTicksWidthUpDown.Value = 3
            Me.m_MajorTicskLengthUpDown.ValueChanged += AddressOf OnUpDownMajorTickLengthChanged
            majorTicksGroupBoxGroupBoxContent.Add(New NPairBox("Length:", m_MajorTicskLengthUpDown, True))

            ' minor ticks visible check box
            m_MinorTicksVisability = New NCheckBox("Minor Tick Visible")
            m_MinorTicksVisability.Checked = True
            Me.m_MinorTicksVisability.CheckedChanged += AddressOf OnMinorTicksVisibilityCheckedChanged
            minorTicksGroupBoxContent.Add(m_MinorTicksVisability)

            ' minor ticks placement
            m_MinorTickPlacmentComboBox = New NComboBox()
            m_MinorTickPlacmentComboBox.Items.FillFromEnum(Of ENTicksPlacement)()
            m_MinorTickPlacmentComboBox.SelectedIndex = m_MinorTickPlacmentComboBox.SelectedIndex
            Me.m_MinorTickPlacmentComboBox.SelectedIndexChanged += AddressOf OnMinorTickPlacementComboBoxSelectedIndexChanged
            minorTicksGroupBoxContent.Add(New NPairBox("Placement: ", m_MinorTickPlacmentComboBox, True))

            ' minor ticks Shape 
            m_MinorTickShapeComboBox = New NComboBox()
            m_MinorTickShapeComboBox.Items.FillFromEnum(Of ENScaleValueMarkerShape)()
            m_MinorTickShapeComboBox.SelectedIndex = m_MinorTickShapeComboBox.SelectedIndex
            Me.m_MinorTickShapeComboBox.SelectedIndexChanged += AddressOf OnMinorTickShapeComboBoxSelectedIndexChanged
            minorTicksGroupBoxContent.Add(New NPairBox("Shape: ", m_MinorTickShapeComboBox, True))

            ' minor ticks Fill
            m_MinorTicksFillColorButton = New NButton("Minor Ticks Fill Color")
            Me.m_MinorTicksFillColorButton.Click += AddressOf OnMinorTickFillButtonClick
            minorTicksGroupBoxContent.Add(m_MinorTicksFillColorButton)

            ' minor tick width 
            m_MinorTicskWidthUpDown = New NNumericUpDown()
            m_MinorTicskWidthUpDown.Value = 3
            Me.m_MinorTicskWidthUpDown.ValueChanged += AddressOf OnUpDownMinorTickWidthChanged
            '  m_MinorTicskWidthUpDown.Value = Math.Min(Math.Max(m_MinorTicskWidthUpDown.Value, 2), 20);
            minorTicksGroupBoxContent.Add(New NPairBox("Width:", m_MinorTicskWidthUpDown, True))

            Return stack
        End Function


        Public Function GetExampleDescription() As String
            Return "

Major tick marks are the primary indicators of a gauge. Minor tick marks are secondary indicators displayed in between the major tick marks.

" End Function ''' ''' Gets the relevant documentation links for the example ''' ''' Public Function GetDocumentationUrls() As (String, String)() Return {("Scale Ticks", "https://www.nevron.com/docs/openvision/scale-ticks.html"), ("Gauges Axes", "https://www.nevron.com/docs/openvision/gauges-axes.html")} End Function #End Region #Region "Implementation" #End Region #Region "Event Handlers" Private Sub OnOuterMajorTicksVisibilityCheckedChanged(arg As NValueChangeEventArgs) Dim checkedValue = m_OuterMajorTicksVisibility.Checked m_Scale.OuterMajorTicks.Visible = checkedValue m_MajorTickShapeComboBox.Enabled = checkedValue m_MajorTicksFillColorButton.Enabled = checkedValue m_MajorTicksWidthUpDown.Enabled = checkedValue m_MajorTicskLengthUpDown.Enabled = checkedValue m_MajorTickPlacmentComboBox.Enabled = checkedValue End Sub Private Sub OnMajorTickPlacementComboBoxSelectedIndexChanged(arg As NValueChangeEventArgs) Dim selectedPlacement As ENTicksPlacement = m_MajorTickPlacmentComboBox.SelectedIndex End Sub Private Sub OnMajorTickShapeComboBoxSelectedIndexChanged(arg As NValueChangeEventArgs) m_Scale.OuterMajorTicks.Shape = CType(m_MajorTickShapeComboBox.SelectedIndex, ENScaleValueMarkerShape) End Sub Private Sub OnOuterMajorTickFillButtonClick(arg As NEventArgs) Call NEditorWindow.CreateForType(CType(CType(m_Scale.OuterMajorTicks.Fill.DeepClone(), NFill), NFill), Nothing, CType(m_Scale.OuterMajorTicks.DisplayWindow, NWindow), CBool(False), New DNFunction(Of T)(AddressOf OnOuterMajorTicksFillEdited)).Open() End Sub Private Sub OnOuterMajorTicksFillEdited(fill As NFill) m_Scale.OuterMajorTicks.Fill = CType((fill.DeepClone()), NFill) End Sub Private Sub OnUpDownMajorTickWidthChanged(arg As NValueChangeEventArgs) Dim majorTickWidth As Double = arg.NewValue If majorTickWidth >= 2 AndAlso majorTickWidth <= 20 Then m_Scale.OuterMajorTicks.Width = majorTickWidth Else ' Revert the value change m_MajorTicksWidthUpDown.Value = m_Scale.OuterMajorTicks.Width End If End Sub Private Sub OnUpDownMajorTickLengthChanged(arg As NValueChangeEventArgs) Dim majorTickLength As Double = arg.NewValue If majorTickLength >= 2 AndAlso majorTickLength <= 20 Then m_Scale.OuterMajorTicks.Length = majorTickLength Else m_MajorTicskLengthUpDown.Value = m_Scale.OuterMajorTicks.Length End If End Sub Private Sub OnMinorTicksVisibilityCheckedChanged(arg As NValueChangeEventArgs) Dim checkedValue = m_MinorTicksVisability.Checked m_Scale.OuterMinorTicks.Visible = checkedValue m_MinorTickShapeComboBox.Enabled = checkedValue m_MinorTicksFillColorButton.Enabled = checkedValue m_MinorTicskWidthUpDown.Enabled = checkedValue m_MajorTickPlacmentComboBox.Enabled = checkedValue End Sub Private Sub OnUpDownMinorTickWidthChanged(arg As NValueChangeEventArgs) Dim minorTickWidth As Double = arg.NewValue If minorTickWidth >= 2 AndAlso minorTickWidth <= 20 Then m_Scale.OuterMinorTicks.Width = minorTickWidth Else ' Revert the value change m_MinorTicskWidthUpDown.Value = m_Scale.OuterMinorTicks.Width End If End Sub Private Sub OnMinorTickPlacementComboBoxSelectedIndexChanged(arg As NValueChangeEventArgs) Dim selectedPlacement As ENTicksPlacement = m_MinorTickPlacmentComboBox.SelectedIndex End Sub Private Sub OnMinorTickShapeComboBoxSelectedIndexChanged(arg As NValueChangeEventArgs) m_Scale.OuterMinorTicks.Shape = CType(m_MinorTickShapeComboBox.SelectedIndex, ENScaleValueMarkerShape) End Sub Private Sub OnMinorTickFillButtonClick(arg As NEventArgs) Call NEditorWindow.CreateForType(CType(CType(m_Scale.OuterMajorTicks.Fill.DeepClone(), NFill), NFill), Nothing, CType(m_Scale.OuterMajorTicks.DisplayWindow, NWindow), CBool(False), New DNFunction(Of T)(AddressOf OnMinorTicksFillEdited)).Open() End Sub Private Sub OnMinorTicksFillEdited(fill As NFill) m_Scale.OuterMinorTicks.Fill = CType((fill.DeepClone()), NFill) End Sub #End Region #Region "Fields" Private m_RadialGauge As NRadialGauge Private m_Scale As NStandardScale Private m_OuterMajorTicksVisibility As NCheckBox Private m_MinorTicksVisability As NCheckBox Private m_MajorTickShapeComboBox As NComboBox Private m_MajorTickPlacmentComboBox As NComboBox Private m_MinorTickPlacmentComboBox As NComboBox Private m_MinorTickShapeComboBox As NComboBox Private m_MajorTicksWidthUpDown As NNumericUpDown Private m_MajorTicskLengthUpDown As NNumericUpDown Private m_MinorTicskWidthUpDown As NNumericUpDown Private m_MajorTicksFillColorButton As NButton Private m_MinorTicksFillColorButton As NButton #End Region #Region "Static Methods" #End Region #Region "Constants" Private Shared ReadOnly defaultRadialGaugeSize As NSize = New NSize(300, 300) #End Region #Region "Nested Types" #End Region End Class

Download a fully functional VB.NET (.vb) Scale Tick Marks Example for WPF Solution

Related Documentation Links