Picture click event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
How to set the specific area in the picture to become a click event?
What control i need to use?
In vb 6, i can use image control because it's transparent when no src is
attached.
In vb.net, i have out of ideaa..
My objective is to develop a interactive map. For example, user click on the
specific area, it will shows data.

Please advice.thank you in advance.

Best regards,
Ocurnos.
 
I would suggest the following approach:

For the image that you wish to put hot-spots on, use Paint or some other
program to create a duplicate of the image with the areas of interest
painted in strong colours.

Use the mouse event handlers of the PictureBox to obtain a coordinate for
the image and then use GetPixel to retrieve the colour from the treated
image. Finally, use this colour value as an index or possibly a key in a
hashtable to obtain the information you need such as a text command or a
delegate.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
In the MouseUp and the MouseDown event you have the X and Y coordinates. If
you define your own regions you don't need to create controls like
pictureboxes. Then write a method that will retrieve the clicked area based
on these X and Y coordinates.

Gabriel Lozano-Morán
 
Back
Top