laying one "transparent" form on another

dalem

Member
Joined
Apr 11, 2005
Messages
17
Programming Experience
10+
not sure if this is correct forum but here goes. i have an application where users need to fill out injury reports for clients and identify the location of the injury. I thought one way of doing this would be to have an image of human body and lay on top of that a mostly transparent image that would have 5-10 hit zones, each corresponding to a standard area of the body.

the user would click one of these zones and i would capture the hit info and record the area of the body.

although experienced with vb.net, this kind of project is new to me.

any ideas of how to get me started on this from preparing the two images to capturing the user click would be appreciated. or is there an easier way to do this?

thanks

dale
 
I think your idea is sound, though i don't think you'll need a layered form. Just a bitmap of the human body, some hit testing and maybe even a bit of manipulation with a colormatrix.

So start with your bitmap of the human body, from there you'll need to indentify the rectangles in which the parts of the human body are located. Then in the mouse move event you'll need to check the co-ordinates of the mouse. If the mouse is inside one of your rectangles then you could then use a colormatrix to adjust the colors in the bitmap to visually indicate that the mouse is over that portion of the image. The it would be just a matter of raising a click event.
 
thanks for the reply. i understand what you're saying but due to my inexperience with working with graphics and images, i have another question. would i insert these rectangles or target areas in a graphic editor outside of vb.net and note what the coordinates are or do it within the vs framework.

is there any readings you can point me on the subject?

thanks!

dale
 
I would do it something like this....

Set up your form with your picture in a picture box or just paint it straight onto the form. For this i would use GDI+ for the whole project, it will be easier in the long run. So what you are looking to do next is to define some rectangles, you dont actually want to draw them, just define their location and size.. so if you wanted to define a 10x10 rectangle at the top left your form or picture box you would use

VB.NET:
Private Rc as new rectangle(0,0,10,10)
 
Then you would hit text this rectangle in the mouse move event...
 
Private sub MouseMove etc.. etc.. handles etc...
 
If Rc.contains(PointToClient(e.x,e.y)) then
 
Messagebox.show("the mouse is inside the rectangle")
end sub


Then it's just a matter of defining the rest of the rectangles in the locations you want them.
I'll try to set up a short demo to illustrate this, i'm a bit busy today but if i can i'll post back with it later.
 
thanks--that helps a lot--i will try this in the next couple of days. i believe you've given me enough to get started--last question--you say i don't really have to draw the rectangle but if i want the user to actually see these hit areas as a guide, then wouldn't i want to draw these target areas for them to see?

so my steps might be:

1) pull in a bitmap of the human body

2) add hit areas throughout the area of the picture box that defines where i want my hit targets to be

3) watch for a click or mouse down event and determine if any hit target has been hit

again, thanks for your help!

dale
 
Thats it exactly, whether or not you decide to draw the rectangle is up to you. Hope it goes well, let me know if you need some more help.
 
thanks!

thanks for all of your help. i will start this project in a few weeks--with your help and a little more reading i've done, i'm sure i'm on my way. if i have any problems, i'll stop back here.:)

thanks!

dale
 
Back
Top