×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

i'm over a red circle? mousemove event

i'm over a red circle? mousemove event

i'm over a red circle? mousemove event

(OP)
i print this little circles on image with:

CODE

For I = 0 To UBound(Route) - 1
        With Route(I)
            Picture1.Circle (.LNG, .LAT), 0.07, vbRed
            Picture1.CurrentY = Picture1.CurrentY + 0.25
            Picture1.Print I & ")" & .Name
        End With
    Next] 

Now, with mousemove event how to intercept when cursor is on the red circle, and get .name?

RE: i'm over a red circle? mousemove event

Ok, so you already have a UDT array that contains all the X and Y coordinates of the centre of the circles and the name (just doesn't track the radius, but you know what that is as it seems to remain constant in your example.

So all you really need to do is iterate through that array to see if the coordinates of the mouse pointer lie within that circle (or cheat, and check whether they are within the bounding box of the circle - at the size you are drawing these the difference will be immaterial). If it is, then simply retrieve the name from the array element you are currently examining

Of course you don't want to have to iterate through the array for all mouse moves, because most of the time it won't be over your circle. So step one is to simply check if the colour under the mouse pointer is red or not - and only if it is to iterate through the array

RE: i'm over a red circle? mousemove event

(OP)
tkx Strongm but not for my knoledgment.

RE: i'm over a red circle? mousemove event

CODE

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim I As Long
    Dim radius As Single
    
    radius = 0.07 ' no idea what scalemode you are using, this is just a copy of the radius you used in your example code
    
    If Picture1.Point(X, Y) = vbRed Then ' Step 1: is pixel under mouse red?
    
        For I = 0 To UBound(route) - 1 ' Step 2: iterate through UDT to see which one represents the red pixel we are over
            With route(I)
                 If X > .lng - radius And X < .lng + radius And Y > .lat - radius And Y < .lat + radius Then ' This one!
                    Debug.Print .name ' Recover the name
                End If
            End With
        Next
    End If
End Sub 

RE: i'm over a red circle? mousemove event

(OP)
tkx a lot, strongm!

RE: i'm over a red circle? mousemove event

(OP)
But... the routine draw a direct line from destination.
possible to draw a route line, similar Google maps?

note:
i just have a Google maps key and Bing Map key.
Choice one from this key.

RE: i'm over a red circle? mousemove event

That's a very different question, I'd start a new thread for that, if I were you

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close