I'm writing a graphing program, and I want to be able to hover my mouse over a point on the graph to reveal details about the point. I'm aware of MouseHover(), but that only works when hovering over the form, not specific points on the form. I've written a function that works, but is incredibly resource intensive and not very reliable using MouseHover:
List<List<Point>> Points { get; set; } = new();
private async void GraphPanel_MouseHover(object sender, EventArgs e)
{
await Task.Run(() => {
do
{
foreach(var pointList in Points)
{
foreach (Point point in pointList)
{
if (Control.MousePosition == point)
{
throw new Exception();
}
}
}
}
while (true);
});
}
Is there a more practical way of doing this?