I wrote a code to draw a line using the mouse.
On mouse down i save where the user clicked.
bool mZgc_MouseDownEvent(ZedGraphControl sender, MouseEventArgs e)
{
GraphPane graphPane = mZgc.GraphPane;
graphPane.ReverseTransform(e.Location, out mMouseDownX, out mMouseDownY);
return false;
}
On mouse up i draw the line:
bool zgc_MouseUpEvent(ZedGraphControl sender, MouseEventArgs e)
{
GraphPane graphPane = mZgc.GraphPane;
double x, y;
graphPane.ReverseTransform(e.Location, out x, out y);
LineObj threshHoldLine = new LineObj(Color.Red, mMouseDownX, mMouseDownY, x, y);
graphPane.GraphObjList.Add(threshHoldLine);
mZgc.Refresh();
return false;
}
The problem is that while the mouse is down, the user don't see the line (because i draw it only on "up" event).
How can i solve it ?
Technically I can use "on hover" and draw/remove the line from the graph each second and refresh the graph, but it's a bit crazy.
Is there a "normal" way to do this ?
Thanks