11-10-2009 01:55 AM
I've implemented a function to move the cursor manually via arrow keys, but sometimes the Cursor.MoveCursor function results in strange behavior. I calculate a new position using (step = 1, 10 or 100):
double NewPosition = ActiveGraph.Cursors[0].XPosition + (step * ((WaveformGraph)ActiveGraph).Plots[0].DefaultIncrement);
if (NewPosition > ((WaveformGraph)ActiveGraph).Plots[0].XAxis.Range.Maximum) {
NewPosition = ((WaveformGraph)ActiveGraph).Plots[0].XAxis.Range.Maximum;
} else if (NewPosition < ((WaveformGraph)ActiveGraph).Plots[0].XAxis.Range.Minimum) {
NewPosition = ((WaveformGraph)ActiveGraph).Plots[0].XAxis.Range.Minimum;
}
Subsequently I set the cursor using:
ActiveGraph.Cursors[0].MoveCursor((int)Math.Round(NewPosition / ((WaveformGraph)ActiveGraph).Plots[0].DefaultIncrement));
After this I see the cursor moving large steps to the left, instead of moving small steps to the right. This especially occurs when I've drawn a second plot in the graph. However, at the moment of moving the cursor, the second graph has already been cleared.
Previously I updated the ActiveGraph.Cursors[0].XPosition property instead of calling MoveCursor. Stepping through the code I saw that the XPosition was not updated at all after adding a value of approx. 0.068: how is this possible?
What's the best way to update the cursor position: MoveCursor or update XPosition?
Kind regards
11-30-2009 08:42 AM
Hi Technoleut,
Could you please post your (sample) Code? That makes it a lot easier to reproduce.
Regards,
Bas