Disabling CursorTool move action
Posted: Tue Nov 09, 2010 8:14 pm
Hi,
I have a TeeChart with a crosshair cursortool that follows the mouse. The crosshair is basically two cursor tool lines, one horizontal and one vertical. When the user moves the mouse the vertical and horizontal cursor tool lines snap to the next series point and the application shows the value for that specific data point. This approach works fine. However, if the user positions the mouse right on top of the cross the mouse cursor changes from "normal" to the "Move" cursor and they are given the choise to manually move the horizontal cursor tool line. Not sure why just the horizontal and not the vertical, but nevertheless, what I need is to keep the user from manually moving either one. The crosshair cursor must simply follow the mouse position snapping to the next series' value. How can I disable the ability to manually move the cursor tool lines? Basically disable the 'move' cursor for both cursor tool lines.
The following code shows how is that I'm creating the cursor tool:
private Steema.TeeChart.Tools.CursorTool _crossHairCursorV = null; // Interactive cross hair cursor tool (vertical line)
private Steema.TeeChart.Tools.CursorTool _crossHairCursorH = null; // Interactive cross hair cursor tool (horizontal line)
private void CreateCrosshairCursorTool(int seriesIndex)
{
// Remove cursor tool (if already available)
if (_crossHairCursorV != null)
MainTeeChart.Chart.Tools.Remove(_crossHairCursorV);
if (_crossHairCursorH != null)
MainTeeChart.Chart.Tools.Remove(_crossHairCursorH);
// Create vertical cursor tool
_crossHairCursorV = new Steema.TeeChart.Tools.CursorTool(MainTeeChart.Chart);
_crossHairCursorV.Pen.Width = 1; // Set initial width
_crossHairCursorV.Pen.Color = Color.Black; // Set initial color
_crossHairCursorV.FastCursor = false;
_crossHairCursorV.FollowMouse = true;
_crossHairCursorV.Snap = true;
_crossHairCursorV.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;
_crossHairCursorV.SnapStyle = Steema.TeeChart.Tools.SnapStyle.Vertical;
_crossHairCursorV.SnapChange += new Steema.TeeChart.Tools.CursorChangeEventHandler(cursorToolVertical_SnapChange);
// Create horizon8tal cursor tool and attach to main chart
_crossHairCursorH = new Steema.TeeChart.Tools.CursorTool(MainTeeChart.Chart);
_crossHairCursorH.Pen.Width = 1; // Set initial width
_crossHairCursorH.Pen.Color = Color.Black; // Set initial color
_crossHairCursorH.FastCursor = false;
_crossHairCursorH.FollowMouse = false; // Horizontal position is calculated based on series value at vertical position
_crossHairCursorH.Snap = true;
_crossHairCursorH.Style = Steema.TeeChart.Tools.CursorToolStyles.Horizontal;
_crossHairCursorH.SnapStyle = Steema.TeeChart.Tools.SnapStyle.Horizontal;
// Attach cursor tool to indicated series
if (seriesIndex >= 0)
{
_crossHairCursorV.Series = MainTeeChart.Series[seriesIndex]; // Set cursor tool to follow indicated series
_crossHairCursorH.Series = MainTeeChart.Series[seriesIndex]; // Set cursor tool to follow indicated series
}
_cursorToolVisible = true;
}
I have a TeeChart with a crosshair cursortool that follows the mouse. The crosshair is basically two cursor tool lines, one horizontal and one vertical. When the user moves the mouse the vertical and horizontal cursor tool lines snap to the next series point and the application shows the value for that specific data point. This approach works fine. However, if the user positions the mouse right on top of the cross the mouse cursor changes from "normal" to the "Move" cursor and they are given the choise to manually move the horizontal cursor tool line. Not sure why just the horizontal and not the vertical, but nevertheless, what I need is to keep the user from manually moving either one. The crosshair cursor must simply follow the mouse position snapping to the next series' value. How can I disable the ability to manually move the cursor tool lines? Basically disable the 'move' cursor for both cursor tool lines.
The following code shows how is that I'm creating the cursor tool:
private Steema.TeeChart.Tools.CursorTool _crossHairCursorV = null; // Interactive cross hair cursor tool (vertical line)
private Steema.TeeChart.Tools.CursorTool _crossHairCursorH = null; // Interactive cross hair cursor tool (horizontal line)
private void CreateCrosshairCursorTool(int seriesIndex)
{
// Remove cursor tool (if already available)
if (_crossHairCursorV != null)
MainTeeChart.Chart.Tools.Remove(_crossHairCursorV);
if (_crossHairCursorH != null)
MainTeeChart.Chart.Tools.Remove(_crossHairCursorH);
// Create vertical cursor tool
_crossHairCursorV = new Steema.TeeChart.Tools.CursorTool(MainTeeChart.Chart);
_crossHairCursorV.Pen.Width = 1; // Set initial width
_crossHairCursorV.Pen.Color = Color.Black; // Set initial color
_crossHairCursorV.FastCursor = false;
_crossHairCursorV.FollowMouse = true;
_crossHairCursorV.Snap = true;
_crossHairCursorV.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;
_crossHairCursorV.SnapStyle = Steema.TeeChart.Tools.SnapStyle.Vertical;
_crossHairCursorV.SnapChange += new Steema.TeeChart.Tools.CursorChangeEventHandler(cursorToolVertical_SnapChange);
// Create horizon8tal cursor tool and attach to main chart
_crossHairCursorH = new Steema.TeeChart.Tools.CursorTool(MainTeeChart.Chart);
_crossHairCursorH.Pen.Width = 1; // Set initial width
_crossHairCursorH.Pen.Color = Color.Black; // Set initial color
_crossHairCursorH.FastCursor = false;
_crossHairCursorH.FollowMouse = false; // Horizontal position is calculated based on series value at vertical position
_crossHairCursorH.Snap = true;
_crossHairCursorH.Style = Steema.TeeChart.Tools.CursorToolStyles.Horizontal;
_crossHairCursorH.SnapStyle = Steema.TeeChart.Tools.SnapStyle.Horizontal;
// Attach cursor tool to indicated series
if (seriesIndex >= 0)
{
_crossHairCursorV.Series = MainTeeChart.Series[seriesIndex]; // Set cursor tool to follow indicated series
_crossHairCursorH.Series = MainTeeChart.Series[seriesIndex]; // Set cursor tool to follow indicated series
}
_cursorToolVisible = true;
}