1

I've already read some threads on the subject but haven't quite found what I'm looking for.

Here's what I have written so far:

Point? prevPosition = null;
ToolTip tooltip = new ToolTip();

void lineGraph_MouseMove(object sender, MouseEventArgs e){
    var pos = e.Location;
    if (prevPosition.HasValue && pos == prevPosition.Value)
        return;
    tooltip.RemoveAll();
    prevPosition = pos;
    var results = lineGraph.HitTest(pos.X, pos.Y, false,ChartElementType.PlottingArea);
    foreach (var result in results){
        if (result.ChartElementType == ChartElementType.PlottingArea){
            var xVal = result.ChartArea.AxisX.PixelPositionToValue(pos.X);
            var yVal = result.ChartArea.AxisY.PixelPositionToValue(pos.Y);
            tooltip.Show("X=" + xVal + ", Y=" + yVal, this.lineGraph,pos.X, pos.Y - 15);
        }
    }
}

But the toolTip doesn't show.

nick zoum
  • 7,216
  • 7
  • 36
  • 80
Maatskappy
  • 11
  • 3
  • It shows just fine. Did you [hook up](http://stackoverflow.com/questions/33275763/copy-datagridview-values-to-textbox/33276161?s=14|0.0000#33276161) the MouseMove code? You do have actual DataPoints, right? – TaW Oct 25 '16 at 14:33
  • 1
    There is is! I just had to got in my graph's property and Select my event on the "MouseMove" under "Mouse" – Maatskappy Oct 25 '16 at 14:37

0 Answers0