Click to See Complete Forum and Search --> : Hit test on a line
Banger77
Apr 3rd, 2000, 02:38 PM
I have got a collection of lines on a form each called Line1(i), I want to be able to click the mouse on one of the lines and be able to retrieve properties about this line. Can this be done and if it can, how do i do it?? help somebody, please
Fox
Apr 4th, 2000, 12:28 AM
I really don't know, it's just an idea:
Dim A As Long
'X and Y are the mouse coordinates
For A = 0 to Line1.Count - 1
If (Y-Line1(A).Y1) / (X-Line1(A).X1) = (Line1(A).Y2-Y) / (Line1(A).X2-X) Then
'Mouse is on line
EndIf
Next
I think it should work... try it out ;)
[Edited by Fox on 04-05-2000 at 07:22 PM]
Fox
Apr 5th, 2000, 12:22 AM
Uh sorry,
I just tested my code and it works only for lines from top-left to lower-right... anyway, hope I helped ya ;) (I'm sure you can modify the code for the other destinations)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.