Link to home
Start Free TrialLog in
Avatar of buckwheat4948
buckwheat4948

asked on

How do you make a image/picture box like html image map

I would like to be able to click in different areas of a image/picture to do different tasks, like imagemaps for html. Click on one spot, load this form, in another spot in the same image and load a different form.
ASKER CERTIFIED SOLUTION
Avatar of twalgrave
twalgrave

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of twalgrave
twalgrave

You could add hotspots if you wanted to get real fancy.  Looking at the following link:

https://www.experts-exchange.com/questions/20166275/Problem-with-hot-spots-in-resizing-pictures.html
You could also add some method such as AddHotSpot() and RemoveHotSpot() to allow the form to track a set of imagemapped areas.  Later the array can be used to determine if the user clicked on an area.

Sample method:

Private Sub AddHotSpot(HotSpotName as string, X1_Position as single, Y1_Position as single, X2_Position as single, Y2_Position as single)
  dim intHotSpotCount as integer

  intHotSpotCount = ubound(mstrHotSpotNameArray)+1
  redim preserve mstrHotSpotNameArray(intHotSpotCount)
  redim preserve msglHotSpotCoordArray(3,intHotSpotCount)

  mstrHotSpotNameArray(intHotSpotCount) = HotSpotName
  msglHotSpotCoordArray(0,intHotSpotCount) = X1_Position
  msglHotSpotCoordArray(1,intHotSpotCount) = Y1_Position
  msglHotSpotCoordArray(2,intHotSpotCount) = X2_Position
  msglHotSpotCoordArray(3,intHotSpotCount) = Y2_Position
end sub

private sub RemoveHotSpot(HotSpotName as string)
  dim intHotSpotCntr as integer

  for intHotSpotCntr = 0 to ubound(mstrHotSpotNameArray)
    if mstrHotSpotNameArray(intHotSpotCntr) = HotSpotName  then
      ' shift all subsequent items down or possibly just void this entry
      ' *** code to shift, then redim

      exit for
    endif
  next intHotSpotCntr
end sub
Avatar of buckwheat4948

ASKER

Thanks, the others replies were more detailed than i needed. After adding an if statement with a y cord, i got what i needed working perfectly. Thanks for the quick reply!