Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clicks on different part of a picture shows different VB forms

Status
Not open for further replies.

dtqui

Programmer
Sep 25, 2000
62
0
0
SG
Hi,
Can anyone help me with this? I have a picture eg a wall with paintings on it, is it possible to use VB to detect mouse click on the different paintings. If the user click on one specific painting, VB can detect and run a specific forms? Just like the image mapping use in HTML, when someone click on one area of a picture, it will go to a particular page.

Thks. :)
 
Could you pick up the X and Y of the mouse on a click event?
Mike
michael.j.lacey@ntlworld.com
 
You have 3 options for this.

1. easy...plot the x y as suggested above in the mouse down or mouse up events and use a...
if x > nn1 and x < nn1 and y >nn3 and y < nn4 then

2. easier still...if the picture on a form doesnt change for that form then draw transparent labels over the top of the picture and wait for someone to click the label. You can also set the mouse icon so the cursor will change to your cursor to indicate the user can click here.

3. hardest...if you want to have non rectangular points to click on then the way to do this is either have a complex array that the x,y checks against(in option 1) or use the prefered option as below

Public Declare Function CreatePolygonRgn Lib &quot;gdi32&quot; (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long

Public Declare Function PtInRegion Lib &quot;gdi32&quot; (ByVal hRgn As Long, ByVal X As Long, ByVal Y As Long) As Long


this is quite complex, especially if you dont know much about API's (calling dll functions). If you need to know more just e me and I can give you a demo program for odd shaped buttons.


chat soon
Michael Brinkworth
Swift Infotech
 
Thks for your tips..

My picture is similar to a diamond shape so I guess I need API. I'm not good in that (don't know which one is the one I need), so can you e-mail me your demo program to dtqui@catcha.com.sg . Thks very much, by the way, what is your e-mail address?
 
i also would like to see this program lordhuh@home.com thanks

Karl Pietri

Karl Pietri
lordhuh.pota.to

 
opps...

I wrote the wrong e-mail account... it is dtqui@catcha.com without the sg. If you have sent me the program, pls send again. Thank you very much..
 
Hi dtqui,

Did you get your program to work? I am looking at something similar and just wondering the best place to start, which method to use etc.

Thank You
Oliver
 
Hi Oliver,

Sorry for the late reply, I didn't check my old threads till now. Hmm, that was quite a few years ago. I never did get that part to work and for the life of me, I cannot remember why and what was I doing then (I've moved on since then). So sorry for not being able to help.

Regards,
dtqui
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top