XScreenToValue
Posted: Tue Oct 24, 2006 4:19 pm
Hi,
In the ActiveX version we used XScreenToValue to determine the nearest point in a series to the mouse pointer. In the .NET version the OnMouseMove event has gone so we are using the standard MouseMove event. However, XScreenToValue returns a very large number when it's given e.X. Does e.X have to be converted first? The code is below:
private void tcSwap_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
int xIndex;
if (tcSwap.SeriesCount > 0)
{
xIndex = (int)tcSwap.Series[0].XScreenToValue(e.X);
if (xIndex > 0 && xIndex < tcSwap.Series[0].Count)
{
// Do something
}
}
}
Thanks for your help.
In the ActiveX version we used XScreenToValue to determine the nearest point in a series to the mouse pointer. In the .NET version the OnMouseMove event has gone so we are using the standard MouseMove event. However, XScreenToValue returns a very large number when it's given e.X. Does e.X have to be converted first? The code is below:
private void tcSwap_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
int xIndex;
if (tcSwap.SeriesCount > 0)
{
xIndex = (int)tcSwap.Series[0].XScreenToValue(e.X);
if (xIndex > 0 && xIndex < tcSwap.Series[0].Count)
{
// Do something
}
}
}
Thanks for your help.