11-27-2012 08:54 PM
Hello,
I used to do that in a winform project by use thefollowing function:
PlotAreaMouseDownCwgraph(short* Button, short* Shift, VARIANT* XPos, VARIANT* YPos)
But in a wpf graph, the PlotAreaMouseLeftButtonDown event seems not contain the xpos and ypos. I wrote the following code and got a wrong result:
void m_Graph_PlotAreaMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (m_Graph.DefaultInteraction == GraphInteraction.None)
{
Point p = m_Graph.GetPlotAreaPosition(e);
cursor.SetRelativePosition(p);
}
}
11-28-2012 02:28 PM
The value returned by GetPlotAreaPosition
is a screen value (the documentation is a bit confusing here; I have created a task to update it).
To use SetRelativePosition
, you can convert the screen value to a relative value by calling the ScreenToRelative
on the graph.
Or you can pass the value returned by GetPlotAreaPosition
directly to the SetScreenPosition
method on the cursor.