Hi everyone, I want to ask about how I can know from where comes one click, my problem its that I have one image in my form, but this image is a map, there are diferent states and I need to recognize from where state is the clik.
Thank everyone.
Printable View
Hi everyone, I want to ask about how I can know from where comes one click, my problem its that I have one image in my form, but this image is a map, there are diferent states and I need to recognize from where state is the clik.
Thank everyone.
Well thats doable but it'll be a pain... your basically gonna have to have limits for each state that your gonna have to check after the click. For example lets just say you had a map of the united states and the click was in south carolina,
These nubmers are not right I'm pretending south carolina is square...
You would have to say
VB Code:
If MouseXPos > 50 and MouseXPos < 100 then If MouseYPoS> 50 and MouseYPos < 100 then msgbox "You clicked on south carolina!" End If End If
You'd have to have something like this for each state and that could be quite a pain considering how odly shaped some states are. If you are any good at bath you could probably set up some geometric equations that would create a hotspot in a since for each state to check with, but I dont feel like taking the time to figure out an example of one of those right now. To late to think that hard :)
Unless you have a map that each state is a different collor then you would only need to do a GetPixelColor on the point of clicking and match it up.
As far as getting where the click was the image box sub mouse up or mouse down would tell you that. I believe they would be in relation to the image although it may be the form if so you'd have to subtract the image.top and image.left from the values to get it in relation to the image box. Also I'm pretty sure the default return is in twips not pixels.