In general, the solution is.
Create a class or record for storing the lines of roads in a convenient form. Sort of:
type TRoad = record From : TPoint; To: TPoint; end;
Store somewhere your roads (array, list, etc.). Draw lines on the canvas. By clicking on the canvas, take the coordinates of the point and determine whether they belong to one of the lines.
If you belong, you process it as you need (for example, change the color of the line; to do this, add color to the TRoad).
Well, and then the optimization of drawing and processing the whole of this business, cutting off invisible lines, perhaps combining lines into a graph, searching for paths. In general, it depends on the task you have there).
You may need some knowledge of algebra, geometry and computer graphics. Well, Algolist to help you.