I am working on a UserControl which displays many line segments. This is done with a GraphicsPath.
When the user moves the mouse a hittest is done to check if it is over any of the line segments, the cursor is changed accordingly, the line can then be clicked.
As long as there are few segments (as in the left example) this works OK and makes sense.
But when there are more and more segments, the hittest becomes senseless and of course very slow (in the example there are 75, 750 and 2500 segments).
What strategy could I use to avoid useless testing and simplify the path if it becomes "dense"?
The line segments are of unknown pattern, they may not be of obvious rectangular outline, but are always some kind of data chart as in the example image.