SnapToPoint not "snapping"
Posted: Fri Aug 31, 2007 8:01 pm
Hello everyone. I have the trial version of the TeeChart .Net controls (getting ready to switch from VCL) and have run into a problem. I have a chart with a series and a CursorTool that I want to use to select the nearest point in the series. If I turn the Snap property to true, it works fine with the vertical line snapping to the nearest series as I move the cursor across the chart. But when I set Snap to false and programmatically call chartTool1.SnapToPoint(), nothing happens and the return value of SnapToPoint is always -1.
Here's the function I wrote to do this.
Can anyone think of what I might be doing wrong?
Thanks,
Randall
Here's the function I wrote to do this.
Code: Select all
private void tChart_MouseUp(object sender, MouseEventArgs e)
{
// use: handle when the user lets go of the mouse button
// inputs:
// returns:
// none
// if the user is not zooming and using the left button, snap-to and select the nearest data point
if ((!zooming)&&(e.Button == MouseButtons.Left))
{
cursorTool1.SnapToPoint();
lblSelectedDate.Text = cursorTool1.XValue.ToString();
colorLine3.Value = cursorTool1.XValue;
}
else
{
cursorTool1.Active = true;
zooming = false;
}
Thanks,
Randall