By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,131 Members | 1,072 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,131 IT Pros & Developers. It's quick & easy.

Dynamically load Image Map coordinates

P: 2
I have an asp.net site that uses a dropdown listbox to select 1 of 6 different images to be displayed at one time. Changing the image is working fine. But I need to define and use a different set of coordinates for each image. One image could have as few as 5 regions, while another could have up to 100. The coordinates will be hardcoded but I can't seem to figure out how to load different sets of "PolygonHotspot" based on which image is displayed. I thought it was going to be as easy as assigning an ID to 100 different hotspots, then turning them off or on and defining the coordinates based on the image name. That seemed like the perfect solution .. until I found out that the PolygonHotspot doesn't have an ID property.

Any help would be GREATLY appreciated! Please email me at bry at herp dot com

Thank you in advance,

Bryan Mohr
Mar 12 '07 #1
Share this Question
Share on Google+
1 Reply


P: 2
Just for reference (even though this doesn't work), here is the code that I was hoping would work:

Expand|Select|Wrap|Line Numbers
  1.     Protected Sub cbImageCombo_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbImageCombo.TextChanged
  2.         Dim strImageName As String = cbImageCombo.Text
  3.         Dim strImageText As String = strImageName
  4.  
  5.         strImageName = "~/Images/" & strImageName.Replace(" ", "_") & ".JPG"
  6.         imImage.ImageUrl = strImageName
  7.         imImage.AlternateText = strImageText
  8.  
  9.         ' First Make all Hotspots inactive
  10.         HS001.HotspotMode = "Inactive"
  11.         HS002.HotspotMode = "Inactive"
  12.         HS003.HotspotMode = "Inactive"
  13.  
  14.         ' Next activate the defined hotspots for the currently selected image
  15.         If (strImageText = "Spinal Cord Side") Then
  16.             HS001.HotSpotMode = "PostBack"
  17.             HS001.AlternateText = "Top Vertebrae"
  18.             HS001.Coordinates = "118,16,127,11,135,4,142,4,154,11,155,16,154,17,143,15,139,15,132,22,118,17,118,17"
  19.             HS001.PostBackValue = "Top Vertebrae"
  20.  
  21.             HS002.HotSpotMode = "PostBack"
  22.             HS002.AlternateText = "Second Vertebrae"
  23.             HS002.Coordinates = "118,32,131,24,131,22,139,15,154,17,156,32,141,25,138,25,137,27,137,29,121,38,119,36"
  24.             HS002.PostBackValue = "Second Vertebrae"
  25.         End If
  26.  
  27.         If (strImageText = "Skeleton Front") Then
  28.             HS001.HotSpotMode = "PostBack"
  29.             HS001.AlternateText = "Skull"
  30.             HS001.Coordinates = "120,14,126,7,134,3,138,3,146,6,151,11,154,17,154,27,152,39,148,41,148,49,142,53,132,53,125,49,125,43,124,39,121,35,121,32,119,28,119,16"
  31.             HS001.PostBackValue = "Skull"
  32.         End If
  33.  
  34.         If (strImageText = "Muscular Man Back") Then
  35.             HS001.HotSpotMode = "PostBack"
  36.             HS001.AlternateText = "Lateral Deltoid - Right"
  37.             HS001.Coordinates = "172,82,180,80,187,79,189,80,194,84,198,89,200,95,201,99,202,107,201,115,192,106,185,98,184,90,178,88,174,85"
  38.             HS001.PostBackValue = "Lateral Deltoid - Right"
  39.  
  40.             HS002.HotSpotMode = "PostBack"
  41.             HS002.AlternateText = "Posterior Deltoid - Left"
  42.             HS002.Coordinates = "100,97,101,114,86,128,81,126,90,107"
  43.             HS002.PostBackValue = "Posterior Deltoid - Left"
  44.  
  45.             HS002.HotSpotMode = "PostBack"
  46.             HS002.AlternateText = "Levator Scapulae - Left"
  47.             HS002.Coordinates = "109,75,127,64,132,57,130,73,112,76"
  48.             HS002.PostBackValue = "Levator Scapulae - Left"
  49.         End If
  50.     End Sub
  51.  
Mar 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.