Content Area to Scale 3D Example for WinForms

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

Content Area to Scale 3D Example for WinForms Description

The example demonstrates how to convert from content area to scale units. This conversion in the case of 3D always requires an additional plane. In the example you can choose between a XY or XZ plane but you can also use YZ for example.


Content Area to Scale 3DExample

C# Content Area to Scale 3D Example Code for Nevron Chart for WinForms
Language: C#

using Nevron.Nov;
using Nevron.Nov.Chart;
using Nevron.Nov.Chart.Tools;
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 - NContentAreaToScale3DExample";

			// 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()
		{
			NChartViewWithCommandBars chartViewWithCommandBars = new NChartViewWithCommandBars();
			NChartView chartView = chartViewWithCommandBars.View;
			chartView.Surface.CreatePredefinedChart(ENPredefinedChartType.Cartesian);

			// configure title
			chartView.Surface.Titles[0].Text = "Converting from Content Area to Scale 3D Coordinates";

			// configure chart
			m_Chart = (NCartesianChart)chartView.Surface.Charts[0];
			m_Chart.Enable3D = true;

            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear);

            // configure a free xyz point chart
            m_Chart.ModelDepth = 55.0f;
            m_Chart.ModelWidth = 55.0f;
            m_Chart.ModelHeight = 55.0f;
            m_Chart.Projection.SetPredefinedProjection(ENPredefinedProjection.PerspectiveTilted);
            m_Chart.LightModel.SetPredefinedLightModel(ENPredefinedLightModel.GlitterLeft);

            // configure x axis to scale in numeric linear mode
            NLinearScale linearScaleX = new NLinearScale();
            m_Chart.Axes[ENCartesianAxis.PrimaryX].Scale = linearScaleX;
			linearScaleX.MajorGridLines.SetShowAtWall(ENChartWall.Bottom, true);
            linearScaleX.MajorGridLines.SetShowAtWall(ENChartWall.Back, true);
            linearScaleX.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot;

            // configure y axis to scale in numeric linear mode
            NLinearScale linearScaleY = new NLinearScale();
            m_Chart.Axes[ENCartesianAxis.PrimaryY].Scale = linearScaleY;
            linearScaleY.MajorGridLines.SetShowAtWall(ENChartWall.Back, true);
            linearScaleY.MajorGridLines.SetShowAtWall(ENChartWall.Left, true);
            linearScaleY.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot;

            // add interlaced stripe for Y axis
            NScaleStrip strip = new NScaleStrip(new NColorFill(NColor.Beige), null, true, 0, 0, 1, 1);
            strip.Interlaced = true;
            linearScaleY.Strips.Add(strip);

            // configure depth axis to scale in numeric linear mode
            NLinearScale linearScaleZ = new NLinearScale();
            m_Chart.Axes[ENCartesianAxis.Depth].Scale = linearScaleZ;
            linearScaleZ.MajorGridLines.SetShowAtWall(ENChartWall.Bottom, true);
            linearScaleZ.MajorGridLines.SetShowAtWall(ENChartWall.Left, true);
            linearScaleZ.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot;

			m_Point = new NPointSeries();
            m_Chart.Series.Add(m_Point);
            m_Point.Name = "Point Series";
            m_Point.DataLabelStyle = new NDataLabelStyle(false);
            m_Point.LegendView.Mode = ENSeriesLegendMode.None;
            m_Point.Shape = ENPointShape3D.Sphere;
            m_Point.Fill = new NColorFill(NColor.Red);
            m_Point.UseXValues = true;
            m_Point.UseZValues = true;

			// limit the axes to show the range [0, 100]
			m_Chart.Axes[ENCartesianAxis.PrimaryX].ViewRangeMode = ENAxisViewRangeMode.FixedRange;
			m_Chart.Axes[ENCartesianAxis.PrimaryX].MinViewRangeValue = 0;
            m_Chart.Axes[ENCartesianAxis.PrimaryX].MaxViewRangeValue = 100;

			m_Chart.Axes[ENCartesianAxis.PrimaryY].ViewRangeMode = ENAxisViewRangeMode.FixedRange;
			m_Chart.Axes[ENCartesianAxis.PrimaryY].MinViewRangeValue = 0;
            m_Chart.Axes[ENCartesianAxis.PrimaryY].MaxViewRangeValue = 100;

            m_Chart.Axes[ENCartesianAxis.Depth].ViewRangeMode = ENAxisViewRangeMode.FixedRange;
            m_Chart.Axes[ENCartesianAxis.Depth].MinViewRangeValue = 0;
            m_Chart.Axes[ENCartesianAxis.Depth].MaxViewRangeValue = 100;

            // create the point creation planes
            m_XZPlane = new NAxisReferenceLine();
            m_XZPlane.DisplayMode = ENReferenceLineDisplayMode.Plane;
            m_XZPlane.Fill = new NColorFill(NColor.FromARGB(125, 255, 0, 0));
            m_XZPlane.Value = 0;
            m_Chart.Axes[ENCartesianAxis.PrimaryY].ReferenceLines.Add(m_XZPlane);

            m_XYPlane = new NAxisReferenceLine();
            m_XYPlane.DisplayMode = ENReferenceLineDisplayMode.Plane;
            m_XYPlane.Fill = new NColorFill(NColor.FromARGB(125, 0, 0, 255));
            m_XYPlane.Value = 0;
            m_Chart.Axes[ENCartesianAxis.Depth].ReferenceLines.Add(m_XYPlane);

            m_Chart.MouseDown += OnChartMouseDown;

            chartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, ENChartPaletteTarget.Series));

			return chartViewWithCommandBars;
		}

        public NWidget CreateExampleControls()
		{
			NStackPanel stack = new NStackPanel();
			NUniSizeBoxGroup group = new NUniSizeBoxGroup(stack);

            m_PointReferencePlaneComboBox = new NComboBox();

            m_PointReferencePlaneComboBox.Items.Add("XZ plane");
            m_PointReferencePlaneComboBox.Items.Add("XY plane");
            m_PointReferencePlaneComboBox.SelectedIndex = 0;
            m_PointReferencePlaneComboBox.SelectedIndexChanged += OnPointReferencePlaneComboBoxSelectedIndexChanged;

            stack.Add(NPairBox.Create("Reference Plane:", m_PointReferencePlaneComboBox));

            m_MouseModeComboBox = new NComboBox();

            m_MouseModeComboBox.Items.Add("Create Point");
            m_MouseModeComboBox.Items.Add("Trackball");
            m_MouseModeComboBox.SelectedIndexChanged += OnMouseModeComboBoxSelectedIndexChanged;
            m_MouseModeComboBox.SelectedIndex = 0;

            stack.Add(NPairBox.Create("Mouse mode:", m_MouseModeComboBox));

            m_XZPlaneValueNumericUpDown = new NNumericUpDown();
            m_XZPlaneValueNumericUpDown.Maximum = 100;
            m_XZPlaneValueNumericUpDown.ValueChanged += OnXZPlaneValueNumericUpDownValueChanged;
            m_XZPlaneValueNumericUpDown.Value = 50;
            stack.Add(NPairBox.Create("XZ Plane Value:", m_XZPlaneValueNumericUpDown));

            m_XYPlaneValueNumericUpDown = new NNumericUpDown();
            m_XYPlaneValueNumericUpDown.Maximum = 100;
            m_XYPlaneValueNumericUpDown.ValueChanged += OnXYPlaneValueNumericUpDownValueChanged;
            m_XYPlaneValueNumericUpDown.Value = 50;
            stack.Add(NPairBox.Create("XY Plane Value:", m_XYPlaneValueNumericUpDown));

            return group;
		}

        public string GetExampleDescription()
		{
			return @"

The example demonstrates how to convert from content area to scale units. This conversion in the case of 3D always requires an additional plane. In the example you can choose between a XY or XZ plane but you can also use YZ for example.

"; } /// /// Gets the relevant documentation links for the example /// /// public (string Name, string Url)[] GetDocumentationUrls() { return new[] { ("3D Charts", "https://www.nevron.com/docs/openvision/3d-charts.html"), ("Cartesian Chart", "https://www.nevron.com/docs/openvision/cartesian-chart.html"), }; } #endregion #region Implementation #endregion #region Event Handlers /// /// /// /// private void OnXYPlaneValueNumericUpDownValueChanged(NValueChangeEventArgs arg) { m_XYPlane.Value = m_XYPlaneValueNumericUpDown.Value; } /// /// /// /// private void OnXZPlaneValueNumericUpDownValueChanged(NValueChangeEventArgs arg) { m_XZPlane.Value = m_XZPlaneValueNumericUpDown.Value; } /// /// /// /// private void OnPointReferencePlaneComboBoxSelectedIndexChanged(NValueChangeEventArgs arg) { NAxisReferenceLine xyPlane = m_Chart.Axes[ENCartesianAxis.Depth].ReferenceLines[0]; NAxisReferenceLine xzPlane = m_Chart.Axes[ENCartesianAxis.PrimaryY].ReferenceLines[0]; if (m_PointReferencePlaneComboBox.SelectedIndex == 0) { xzPlane.Fill = new NColorFill(NColor.FromARGB(125, 255, 0, 0)); xyPlane.Fill = new NColorFill(NColor.FromARGB(125, 0, 0, 255)); m_XZPlaneValueNumericUpDown.Enabled = true; m_XYPlaneValueNumericUpDown.Enabled = false; } else { xzPlane.Fill = new NColorFill(NColor.FromARGB(125, 0, 0, 255)); xyPlane.Fill = new NColorFill(NColor.FromARGB(125, 255, 0, 0)); m_XZPlaneValueNumericUpDown.Enabled = false; m_XYPlaneValueNumericUpDown.Enabled = true; } } /// /// /// /// private void OnMouseModeComboBoxSelectedIndexChanged(NValueChangeEventArgs arg) { if ((int)arg.NewValue == 0) { m_Chart.Interactor = new NInteractor(); } else { NInteractor interactor = new NInteractor(); interactor.Add(new NTrackballTool()); m_Chart.Interactor = interactor; } } /// /// /// /// private void OnChartMouseDown(NMouseButtonEventArgs arg) { if (m_MouseModeComboBox.SelectedIndex != 0) return; NCartesianAxis xAxis = m_Chart.Axes[ENCartesianAxis.PrimaryX]; NCartesianAxis yAxis = m_Chart.Axes[ENCartesianAxis.PrimaryY]; NCartesianAxis zAxis = m_Chart.Axes[ENCartesianAxis.Depth]; if (m_PointReferencePlaneComboBox.SelectedIndex == 0) { NPoint3D pointLogical; if (m_Chart.TransformViewToLogical3D(arg.TargetPosition, ENCartesianAxis.PrimaryX, ENCartesianAxis.Depth, ENCartesianAxis.PrimaryY, m_XZPlaneValueNumericUpDown.Value, out pointLogical)) { pointLogical.X = xAxis.ViewRange.GetValueInRange(pointLogical.X); pointLogical.Z = yAxis.ViewRange.GetValueInRange(pointLogical.Z); pointLogical.Y = zAxis.ViewRange.GetValueInRange(pointLogical.Y); m_Point.DataPoints.Add(new NPointDataPoint(pointLogical.X, pointLogical.Z, pointLogical.Y)); } } else { NPoint3D pointLogical; if (m_Chart.TransformViewToLogical3D(arg.TargetPosition, ENCartesianAxis.PrimaryX, ENCartesianAxis.PrimaryY, ENCartesianAxis.Depth, m_XYPlaneValueNumericUpDown.Value, out pointLogical)) { pointLogical.X = xAxis.ViewRange.GetValueInRange(pointLogical.X); pointLogical.Y = yAxis.ViewRange.GetValueInRange(pointLogical.Y); pointLogical.Z = zAxis.ViewRange.GetValueInRange(pointLogical.Z); m_Point.DataPoints.Add(new NPointDataPoint(pointLogical.X, pointLogical.Y, pointLogical.Z)); } } } #endregion #region Fields NPointSeries m_Point; NCartesianChart m_Chart; NComboBox m_MouseModeComboBox; NComboBox m_PointReferencePlaneComboBox; NNumericUpDown m_XZPlaneValueNumericUpDown; NNumericUpDown m_XYPlaneValueNumericUpDown; NAxisReferenceLine m_XZPlane; NAxisReferenceLine m_XYPlane; #endregion #region Static Methods #endregion #region Constants #endregion #region Nested Types #endregion } }

Download a fully functional C# (.cs) Content Area to Scale 3D Example for WinForms Solution

VB.NET Content Area to Scale 3D Example Code for Nevron Chart for WinForms
Language: VB.NET

Imports Nevron.Nov
Imports Nevron.Nov.Chart
Imports Nevron.Nov.Chart.Tools
Imports Nevron.Nov.Dom
Imports Nevron.Nov.Graphics
Imports Nevron.Nov.Layout
Imports Nevron.Nov.UI
Imports Nevron.Nov.Windows.Forms

Public Class Form1

#Region "Constructors"

    Public Sub New()
        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

        ' Set form title
        Text = "NOV WinForms - NContentAreaToScale3DExample"

        ' 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)
        host.Dock = DockStyle.Fill
        Controls.Add(host)
    End Sub


#End Region

#Region "Example"

        Public Function CreateExampleContent() As NWidget
            Dim chartViewWithCommandBars As NChartViewWithCommandBars = New NChartViewWithCommandBars()
            Dim chartView = chartViewWithCommandBars.View
            chartView.Surface.CreatePredefinedChart(ENPredefinedChartType.Cartesian)

            ' configure title
            chartView.Surface.Titles(0).Text = "Converting from Content Area to Scale 3D Coordinates"

            ' configure chart
            m_Chart = CType(chartView.Surface.Charts(0), NCartesianChart)
            m_Chart.Enable3D = True

            m_Chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XYLinear)

            ' configure a free xyz point chart
            m_Chart.ModelDepth = 55.0F
            m_Chart.ModelWidth = 55.0F
            m_Chart.ModelHeight = 55.0F
            m_Chart.Projection.SetPredefinedProjection(ENPredefinedProjection.PerspectiveTilted)
            m_Chart.LightModel.SetPredefinedLightModel(ENPredefinedLightModel.GlitterLeft)

            ' configure x axis to scale in numeric linear mode
            Dim linearScaleX As NLinearScale = New NLinearScale()
            m_Chart.Axes(ENCartesianAxis.PrimaryX).Scale = linearScaleX
            linearScaleX.MajorGridLines.SetShowAtWall(ENChartWall.Bottom, True)
            linearScaleX.MajorGridLines.SetShowAtWall(ENChartWall.Back, True)
            linearScaleX.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot

            ' configure y axis to scale in numeric linear mode
            Dim linearScaleY As NLinearScale = New NLinearScale()
            m_Chart.Axes(ENCartesianAxis.PrimaryY).Scale = linearScaleY
            linearScaleY.MajorGridLines.SetShowAtWall(ENChartWall.Back, True)
            linearScaleY.MajorGridLines.SetShowAtWall(ENChartWall.Left, True)
            linearScaleY.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot

            ' add interlaced stripe for Y axis
            Dim strip As NScaleStrip = New NScaleStrip(New NColorFill(NColor.Beige), Nothing, True, 0, 0, 1, 1)
            strip.Interlaced = True
            linearScaleY.Strips.Add(strip)

            ' configure depth axis to scale in numeric linear mode
            Dim linearScaleZ As NLinearScale = New NLinearScale()
            m_Chart.Axes(ENCartesianAxis.Depth).Scale = linearScaleZ
            linearScaleZ.MajorGridLines.SetShowAtWall(ENChartWall.Bottom, True)
            linearScaleZ.MajorGridLines.SetShowAtWall(ENChartWall.Left, True)
            linearScaleZ.MajorGridLines.Stroke.DashStyle = ENDashStyle.Dot

            m_Point = New NPointSeries()
            m_Chart.Series.Add(m_Point)
            m_Point.Name = "Point Series"
            m_Point.DataLabelStyle = New NDataLabelStyle(False)
            m_Point.LegendView.Mode = ENSeriesLegendMode.None
            m_Point.Shape = ENPointShape3D.Sphere
            m_Point.Fill = New NColorFill(NColor.Red)
            m_Point.UseXValues = True
            m_Point.UseZValues = True

            ' limit the axes to show the range [0, 100]
            m_Chart.Axes(ENCartesianAxis.PrimaryX).ViewRangeMode = ENAxisViewRangeMode.FixedRange
            m_Chart.Axes(ENCartesianAxis.PrimaryX).MinViewRangeValue = 0
            m_Chart.Axes(ENCartesianAxis.PrimaryX).MaxViewRangeValue = 100

            m_Chart.Axes(ENCartesianAxis.PrimaryY).ViewRangeMode = ENAxisViewRangeMode.FixedRange
            m_Chart.Axes(ENCartesianAxis.PrimaryY).MinViewRangeValue = 0
            m_Chart.Axes(ENCartesianAxis.PrimaryY).MaxViewRangeValue = 100

            m_Chart.Axes(ENCartesianAxis.Depth).ViewRangeMode = ENAxisViewRangeMode.FixedRange
            m_Chart.Axes(ENCartesianAxis.Depth).MinViewRangeValue = 0
            m_Chart.Axes(ENCartesianAxis.Depth).MaxViewRangeValue = 100

            ' create the point creation planes
            m_XZPlane = New NAxisReferenceLine()
            m_XZPlane.DisplayMode = ENReferenceLineDisplayMode.Plane
            m_XZPlane.Fill = New NColorFill(NColor.FromARGB(125, 255, 0, 0))
            m_XZPlane.Value = 0
            m_Chart.Axes(ENCartesianAxis.PrimaryY).ReferenceLines.Add(m_XZPlane)

            m_XYPlane = New NAxisReferenceLine()
            m_XYPlane.DisplayMode = ENReferenceLineDisplayMode.Plane
            m_XYPlane.Fill = New NColorFill(NColor.FromARGB(125, 0, 0, 255))
            m_XYPlane.Value = 0
            m_Chart.Axes(ENCartesianAxis.Depth).ReferenceLines.Add(m_XYPlane)

            Me.m_Chart.MouseDown += AddressOf OnChartMouseDown

            chartView.Document.StyleSheets.ApplyTheme(New NChartTheme(ENChartPalette.Bright, ENChartPaletteTarget.Series))

            Return chartViewWithCommandBars
        End Function

        Public Function CreateExampleControls() As NWidget
            Dim stack As NStackPanel = New NStackPanel()
            Dim group As NUniSizeBoxGroup = New NUniSizeBoxGroup(stack)

            m_PointReferencePlaneComboBox = New NComboBox()

            m_PointReferencePlaneComboBox.Items.Add("XZ plane")
            m_PointReferencePlaneComboBox.Items.Add("XY plane")
            m_PointReferencePlaneComboBox.SelectedIndex = 0
            Me.m_PointReferencePlaneComboBox.SelectedIndexChanged += AddressOf OnPointReferencePlaneComboBoxSelectedIndexChanged

            stack.Add(NPairBox.Create("Reference Plane:", m_PointReferencePlaneComboBox))

            m_MouseModeComboBox = New NComboBox()

            m_MouseModeComboBox.Items.Add("Create Point")
            m_MouseModeComboBox.Items.Add("Trackball")
            Me.m_MouseModeComboBox.SelectedIndexChanged += AddressOf OnMouseModeComboBoxSelectedIndexChanged
            m_MouseModeComboBox.SelectedIndex = 0

            stack.Add(NPairBox.Create("Mouse mode:", m_MouseModeComboBox))

            m_XZPlaneValueNumericUpDown = New NNumericUpDown()
            m_XZPlaneValueNumericUpDown.Maximum = 100
            Me.m_XZPlaneValueNumericUpDown.ValueChanged += AddressOf OnXZPlaneValueNumericUpDownValueChanged
            m_XZPlaneValueNumericUpDown.Value = 50
            stack.Add(NPairBox.Create("XZ Plane Value:", m_XZPlaneValueNumericUpDown))

            m_XYPlaneValueNumericUpDown = New NNumericUpDown()
            m_XYPlaneValueNumericUpDown.Maximum = 100
            Me.m_XYPlaneValueNumericUpDown.ValueChanged += AddressOf OnXYPlaneValueNumericUpDownValueChanged
            m_XYPlaneValueNumericUpDown.Value = 50
            stack.Add(NPairBox.Create("XY Plane Value:", m_XYPlaneValueNumericUpDown))

            Return group
        End Function

        Public Function GetExampleDescription() As String
            Return "

The example demonstrates how to convert from content area to scale units. This conversion in the case of 3D always requires an additional plane. In the example you can choose between a XY or XZ plane but you can also use YZ for example.

" End Function ''' ''' Gets the relevant documentation links for the example ''' ''' Public Function GetDocumentationUrls() As (String, String)() Return {("3D Charts", "https://www.nevron.com/docs/openvision/3d-charts.html"), ("Cartesian Chart", "https://www.nevron.com/docs/openvision/cartesian-chart.html")} End Function #End Region #Region "Implementation" #End Region #Region "Event Handlers" ''' ''' ''' ''' Private Sub OnXYPlaneValueNumericUpDownValueChanged(arg As NValueChangeEventArgs) m_XYPlane.Value = m_XYPlaneValueNumericUpDown.Value End Sub ''' ''' ''' ''' Private Sub OnXZPlaneValueNumericUpDownValueChanged(arg As NValueChangeEventArgs) m_XZPlane.Value = m_XZPlaneValueNumericUpDown.Value End Sub ''' ''' ''' ''' Private Sub OnPointReferencePlaneComboBoxSelectedIndexChanged(arg As NValueChangeEventArgs) Dim xyPlane As NAxisReferenceLine = m_Chart.Axes(ENCartesianAxis.Depth).ReferenceLines(0) Dim xzPlane As NAxisReferenceLine = m_Chart.Axes(ENCartesianAxis.PrimaryY).ReferenceLines(0) If m_PointReferencePlaneComboBox.SelectedIndex = 0 Then xzPlane.Fill = New NColorFill(NColor.FromARGB(125, 255, 0, 0)) xyPlane.Fill = New NColorFill(NColor.FromARGB(125, 0, 0, 255)) m_XZPlaneValueNumericUpDown.Enabled = True m_XYPlaneValueNumericUpDown.Enabled = False Else xzPlane.Fill = New NColorFill(NColor.FromARGB(125, 0, 0, 255)) xyPlane.Fill = New NColorFill(NColor.FromARGB(125, 255, 0, 0)) m_XZPlaneValueNumericUpDown.Enabled = False m_XYPlaneValueNumericUpDown.Enabled = True End If End Sub ''' ''' ''' ''' Private Sub OnMouseModeComboBoxSelectedIndexChanged(arg As NValueChangeEventArgs) If CInt(arg.NewValue) = 0 Then m_Chart.Interactor = New NInteractor() Else Dim interactor As NInteractor = New NInteractor() interactor.Add(New NTrackballTool()) m_Chart.Interactor = interactor End If End Sub ''' ''' ''' ''' Private Sub OnChartMouseDown(arg As NMouseButtonEventArgs) If m_MouseModeComboBox.SelectedIndex <> 0 Then Return Dim xAxis = m_Chart.Axes(ENCartesianAxis.PrimaryX) Dim yAxis = m_Chart.Axes(ENCartesianAxis.PrimaryY) Dim zAxis = m_Chart.Axes(ENCartesianAxis.Depth) If m_PointReferencePlaneComboBox.SelectedIndex = 0 Then Dim pointLogical As NPoint3D If m_Chart.TransformViewToLogical3D(arg.TargetPosition, ENCartesianAxis.PrimaryX, ENCartesianAxis.Depth, ENCartesianAxis.PrimaryY, m_XZPlaneValueNumericUpDown.Value, pointLogical) Then pointLogical.X = xAxis.ViewRange.GetValueInRange(pointLogical.X) pointLogical.Z = yAxis.ViewRange.GetValueInRange(pointLogical.Z) pointLogical.Y = zAxis.ViewRange.GetValueInRange(pointLogical.Y) m_Point.DataPoints.Add(New NPointDataPoint(pointLogical.X, pointLogical.Z, pointLogical.Y)) End If Else Dim pointLogical As NPoint3D If m_Chart.TransformViewToLogical3D(arg.TargetPosition, ENCartesianAxis.PrimaryX, ENCartesianAxis.PrimaryY, ENCartesianAxis.Depth, m_XYPlaneValueNumericUpDown.Value, pointLogical) Then pointLogical.X = xAxis.ViewRange.GetValueInRange(pointLogical.X) pointLogical.Y = yAxis.ViewRange.GetValueInRange(pointLogical.Y) pointLogical.Z = zAxis.ViewRange.GetValueInRange(pointLogical.Z) m_Point.DataPoints.Add(New NPointDataPoint(pointLogical.X, pointLogical.Y, pointLogical.Z)) End If End If End Sub #End Region #Region "Fields" Private m_Point As NPointSeries Private m_Chart As NCartesianChart Private m_MouseModeComboBox As NComboBox Private m_PointReferencePlaneComboBox As NComboBox Private m_XZPlaneValueNumericUpDown As NNumericUpDown Private m_XYPlaneValueNumericUpDown As NNumericUpDown Private m_XZPlane As NAxisReferenceLine Private m_XYPlane As NAxisReferenceLine #End Region #Region "Static Methods" #End Region #Region "Constants" #End Region #Region "Nested Types" #End Region End Class

Download a fully functional VB.NET (.vb) Content Area to Scale 3D Example for WinForms Solution

Related Documentation Links