Results 1 to 2 of 2

Thread: Click, in a especific part in a form

  1. #1

    Thread Starter
    Lively Member angel of dark's Avatar
    Join Date
    Dec 2002
    Location
    Leon guanajuato Mexico
    Posts
    74

    Click, in a especific part in a form

    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.
    al peor programador hasta el HELLO WORLD le marca error.....

    event to the worst programmer the Hello world marks him error..

  2. #2
    Fanatic Member
    Join Date
    Sep 2002
    Location
    Lexington, SC
    Posts
    586
    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:
    1. If MouseXPos > 50 and MouseXPos < 100 then
    2. If MouseYPoS> 50 and MouseYPos < 100 then
    3. msgbox "You clicked on south carolina!"
    4. End If
    5. 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.

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