GPWiki.org
GPWiki.org
It is currently Tue May 21, 2013 11:48 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Feb 06, 2009 7:41 am 
How can I make parts of a picture box interactable (clickable), or is this simply out of the scope of a picture box? For instance I want to present rooms with puzzles that the user can click on to use (levers, torches, etc).
I don't want to simply overlay dozens of smaller picture boxes that could probably work but isn't worth the mess and confusion.

I certainly don't need a 3d engine or have the time to invest to go that route. Thanks for any help.


Top
  
 
 Post subject:
PostPosted: Fri Feb 06, 2009 8:51 am 
Level 1 Cleric

Joined: Sun Mar 11, 2007 12:00 am
Posts: 10
You could do this with the MouseUp event of the picturebox. It's parameters include a mask (like shift or control) and x and y coordinates where the mouse up was completed.

You could send these coordinates to a function that checks if the coordinates are in a certain area of the picture using some simple fomulas, like say for a rectangle, if x > left side and< right side, and y is > top and < bottom then it is in the box.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 06, 2009 11:26 am 
Level 22 Norse Warrior-Librarian
User avatar

Joined: Fri Aug 20, 2004 1:58 pm
Posts: 538
Location: UK
Clickable areas are easy enough with picture boxes as it provides you with mouse co-ordinates on mouseup - just figure out bounding rectangles.

If you want part of the image to then change (i.e. a lever moves) you'll probably want to use bitblt and have a couple of offscreen images (or a single combined sprite sheet) - it's fairly straightforward though.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group