Results 1 to 8 of 8

Thread: *resolved* Hot spots on scrollable image

  1. #1

    Thread Starter
    Addicted Member Monkey Man's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere deep in the Caribbean.....
    Posts
    202

    Exclamation *resolved* Hot spots on scrollable image

    Hello peeps,

    I'm trying to make a program which will have a picture (usually too tall to fit completely on screen - hence it will have to be scrollable) - and I want to add multiple hot spots around the picture so the user can click on the relevant part.

    I can get the image in mulitple formats - i.e .pdf, .gif, .jpg etc. Which would be the best to use & how can it be done...

    TIA

    Jordan
    Last edited by Monkey Man; Dec 19th, 2002 at 06:14 AM.

  2. #2
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    First you would have to know how to open up the warious file formats...a good start would probably be to look at this page...

    http://www.filespecs.com/index.jsp

    ...BTW good luck...

  3. #3
    Addicted Member
    Join Date
    Aug 2002
    Location
    Baltimore, MD
    Posts
    230
    If you don't need anything except rectangular hot spots, just keep an array of rects in memory and use the IntersectRect API call. You'll have to calculate the rect on the PictureBox based on the full picture view, not just the portion visible on screen.

  4. #4

    Thread Starter
    Addicted Member Monkey Man's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere deep in the Caribbean.....
    Posts
    202
    Can you create the rects inside the picture box or would I have to move the boxes when the user uses the scroll bar. There will be around 30 hot-spots needed (possibly more) when just a portion is shown with about 50 hidden out of screen. I think it would take too much to calculate when a hot-spot has passed the boarder and assign a new rect when a new one enters.

    As with the natwest - there must be another way....

    TIA

  5. #5
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    What Machaira was talking about was not having a physically box...just some X and Y coordinates in memory. So an array of those X,Y coordinates (rects) can hold the hot spots...And you would have to add how much you have scrolled in X and Y direction to the cursor click to see if it hits a hot spot....

  6. #6

    Thread Starter
    Addicted Member Monkey Man's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere deep in the Caribbean.....
    Posts
    202
    I've been doing some searching & found that you can put controls into picture boxes (i.e labels) which will keep their dimensions (i.e left, top, width & height) relative to the picture box (so if the control is at the top left of the picture box it's left & top properties will be 0,0. This would be great because it means I can load all of the hot spots up at the start and not have to recalculate when the user scrolls. Just one question:

    What control should I use (should I use one with a hWnd handle so I can hot-track - or just lots of captions & use the tag to process info on the label click)

    The main thing I'm looking for is speed.

    Thanks for your help.

  7. #7
    Addicted Member
    Join Date
    Aug 2002
    Location
    Baltimore, MD
    Posts
    230
    Take a look at the attached and see if it's what you're looking for.

    Stick any picture in PictureBox1 and click in the picture. If you click in the region marked by the rect in the code you'll get a message box even if you scroll the picturebox.

    This took me about 2 minutes to whip up so don't expect perfection.
    Attached Files Attached Files

  8. #8

    Thread Starter
    Addicted Member Monkey Man's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere deep in the Caribbean.....
    Posts
    202
    Perfect, just what I needed...

    Thanks all.....
    Last edited by Monkey Man; Dec 19th, 2002 at 06:14 AM.
    (\/)onkey


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