Hello all
I have a line drawn on picturebox.
Now i want to run some command if a mouse location is on drawn line area.
How can i do this ?
Thanks in advance.
Printable View
Hello all
I have a line drawn on picturebox.
Now i want to run some command if a mouse location is on drawn line area.
How can i do this ?
Thanks in advance.
Use the pictureboxe's _mousemove event and compare the mouse location with the x, y location of your line.
If your line is diagonal, it becomes slightly more difficult, requiring a mathematical formula
Like this ?
or u have other easiest way ?Code:For Each Line As Line In LineS
If e.Location.X >= Line.Start.X And e.Location.Y >= Line.Start.Y And _
e.Location.X <= Line.End.X And e.Location.Y <= Line.End.Y Then
'Some Command
End If
Next
a Line is saved on a List(Of Line) named Lines.
That could work. Have you tried it?
Yea its work. But i just find a easiest way.
Could you share that way with us?
In case your search isn't over, take a look at this, more specially at post #31 by Boops Boops.