Image Mapping

Templeton Peck
03-16-2003, 04:17 PM
Hey,

i'm new to Visual Basic and was wondering how you could load one image and have it so as individual parts of it are clicked it loads a new form or screen or what have you.. like image mapping.

There's something in the code library but I can't figure out how to use it.

I'm really new at this so if someone could explain how to do it (or use the code library's file) i'd appreciate it

OnErr0r
03-16-2003, 04:54 PM
Just use the mousedown event and split the control up into sections mathematically. The entire control is 0,0 to controlname.scalewidth, controlname.scaleheight. So the top left quarter would be:

0,0 to controlname.scalewidth \ 2, controlname.scaleheight \ 2

See if you can figure out the other three quarters on your own.

Templeton Peck
03-17-2003, 03:50 PM
Just use the mousedown event and split the control up into sections mathematically. The entire control is 0,0 to controlname.scalewidth, controlname.scaleheight. So the top left quarter would be:

0,0 to controlname.scalewidth \ 2, controlname.scaleheight \ 2

See if you can figure out the other three quarters on your own.


But is that going to work very well for spllitting it up like 20 times or so? because thats what i'm looking at doing, and the pieces aren't exactly going to be the same space everytime. Just wondering if there's a simpler way, then figuring out a bunch of math for a lot of area's.

Thanks,

Peck

OnErr0r
03-17-2003, 04:01 PM
Whether you divide by 2 making 4 pieces or 20 making 400, you still have to use math to figure out where each piece is. You might have partial pieces as well, depending on the size.

This might sound difficult, but its really simple. You create a function to return which portion of the image you clicked based on X/Y passed to MouseMove.

Templeton Peck
03-17-2003, 04:21 PM
I'm still lost, my vb is weak..

thanks for trying

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum