MouseDown on Image

Roonster
02-17-2005, 08:28 AM
I have a map of the world as an image, and I'm trying to make it so that whenever the mouse is clicked on one certain area, for example, Europe, then the word Europe is printed out....basically I need to split the map up so that there are different sensitive areas.

Is this possible with MouseDown event or would it be better to split the map up into different areas & fit them together on the form using different image boxes?

headkaze
02-17-2005, 09:33 AM
I have a map of the world as an image, and I'm trying to make it so that whenever the mouse is clicked on one certain area, for example, Europe, then the word Europe is printed out....basically I need to split the map up so that there are different sensitive areas.

Is this possible with MouseDown event or would it be better to split the map up into different areas & fit them together on the form using different image boxes?

You could have each area of your map in different colors in one picturebox, then use the mousedown event, read in the mouse coordinates, then use getpixel to read the color of the selected pixel. Then use Select Case to process each area/color.

noi_max
02-17-2005, 09:41 AM
If you're interested, here's the old "Axis and Allies" thread.
http://www.xtremevbtalk.com/showthread.php?t=187503

Talks about image mapping to select countries on a map.

Hope that helps

Roonster
02-17-2005, 10:20 AM
Thanks for the help! Gratefully received!

I think I'll use the getPixel function - any ideas where I find the API or any examples?

Thanks!

noi_max
02-17-2005, 10:40 AM
GetPixel

I would suggest downloading the API Guide (from AllAPI), while it's still available :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum