One way that you could do this would be to handle the graph's PlotAreaMouseHover event. In the event handler, you can call
Control.MousePosition to get the mouse cursor position in screen coordinates, pass these coordinates to the
PointToClient method on the graph to convert these screen coordinates to control client coordinates, then pass these coordinates to the graph's GetAnnotationAt method. If GetAnnotationAt returns a non-null reference, the mouse is over an annotation, and you can then display a tooltip for the annotation. Here is a code snippet that demonstrates this:
private void OnGraphPlotAreaMouseHover(object sender, EventArgs e)
{
Point mousePoint = graph.PointToClient(Control.MousePosition);
XYAnnotation annotation = graph.GetAnnotationAt(mousePoint.X, mousePoint.Y);
if (annotation != null)
{
// Display annotation tooltip here.
}
}
This is a good feature idea and I will file a suggestion to add tooltip support to annotations in a future version of Measurement Studio.
- Elton