Okay so I have this idea for the project I am currently doing for my school coursework where a music note can be dragged by the mouse onto the stave and if it's within a certain set of coordinates it will automatic snap to the wanted line, What I need help with is checking if the music note is within the set of coordinates and then setting it to the coordinates of the nearest line, which for right now there is only 1 line as I have taken this aspect out of my main project and working on it in a seperate project to get it right before implementing it into my main program.

