Results 1 to 3 of 3

Thread: Hit test on a line

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    5
    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

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    I really don't know, it's just an idea:

    Code:
    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]

  3. #3
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width