Dundas Chart for Windows Forms
NewPosition Property
See Also  Example Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace > CursorEventArgs Class : NewPosition Property


Gets the position of a cursor, and depending on the event also sets the cursor's position.
New cursor position.

Syntax

Visual Basic (Declaration)  
Public Property NewPosition As Double
Visual Basic (Usage) Copy Code
Dim instance As CursorEventArgs
Dim value As Double
 
instance.NewPosition = value
 
value = instance.NewPosition
C#  
public double NewPosition {get; set;}

Return Value

A double value that represents the position of a cursor along an axis.

Example

In this example we only limit the X axis cursor position if it is the X axis cursor in a chart area named Chart Area 1.
Visual Basic Copy Code
Imports Dundas.Charting.WinControl

...

Private Sub chart1_CursorPositionChanging(ByVal sender As Object, _
ByVal e As Dundas.Charting.WinControl.CursorEventArgs) Handles chart1.CursorPositionChanging

If e.ChartArea.Name = "Chart Area 1" Then

    If e.Axis.Type = AxisName.X Then

    If e.NewPosition > 3 Then
        e.NewPosition = 3
    End If
End If

End Sub
In this example we only limit the X axis cursor position if it is the X axis cursor in a chart area named Chart Area 1.
C# Copy Code
using Dundas.Charting.WinControl;
...
private void chart1_CursorPositionChanging(object sender, Dundas.Charting.WinControl.CursorEventArgs e){

   
if(e.ChartArea.Name == "Chart Area 1")
   {

       
if(e.Axis.Type == AxisName.X)
       {
           
if(e.NewPosition > 3)
               e.NewPosition = 3;
       }
   }
}

Remarks

This property represents the new position of a cursor, and can be used in the CursorPositionChanging and CursorPositionChanged events to get the cursor position.  It can also be used in the CursorPositionChanging event to set the cursor position. 

Note that setting this property in the SelectionRangeChanging event will have no effect (NewPosition will have a value of Double.Nan in this event).

To determine the chart area that the event is being raised for use the ChartArea property.

To determine if this end position is for a range selected along the primary or secondary X or Y axis use the Axis property. 

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2009 All Rights Reserved.