Clickable invisible region

seahunt

Member
Joined
Jan 25, 2007
Messages
6
Programming Experience
10+
A while ago I made a graphics based GUI and wanted to use clickable regions. At the time I couldn't figure out how to. Can anyone say how to make an invisible clickable region on an image. I used to do this with the predecessor to .Net
........... My solution at the time was to place the image as background and then put small sections of the image in picture boxes aligned on top of the image. Those pictureboxes were clickable.... Cklicking on them opened forms and such. The problem was that one of the small images always stayed on top no matter what other forms were opened. I tried to figure out if it was a Z Order problem, but it didn't seem so. Anyway, any suggestions for either problem would be appreciated.
T'anks, seahunt
 
A region is a region is a region. In .Net you could use a region, or a rectangle. An invisible region is just a region that has not been painted. Say i has an image on a form 50x50 at co-ordinates

x = 20
y = 50

i could create a region i could hittest with a rectangle.

VB.NET:
Dim HitTestRct as new rectangle(20,50,10,10)
This would create a rectangle at the top left corner of the image 10 pixels wide and 10 pixels high.

If i wanted to determine whether the mouse was inside that rectangle then i would override the MouseMove event and put the following..

VB.NET:
If HitTestRect.Contains(e.x,e.y) then
MessageBox.show("Cursor is inside the invisible region")
with me?
 
Back
Top