[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

click on a picture

Hello,
I'm importing a picture of a cabinet and i was wondering if there was anyway to have different events fire off when a specific location is clicked on the picture.  for example, i have a picture of the cabinet with 5 drawers.  i want to be able to go to a specific drawer if the user double clicks on it.  This is for an inventory project i'm working that i would then get the info from a DB.  I know each picturebox has a doubleclick event, but my understanding of that is its for the entire picturebox.  Am i making sense with my question?  thanks for the help!

0
kevinmeredith
Asked:
kevinmeredith
  • 3
  • 3
  • 3
1 Solution
 
jake072Commented:
You could trap the location of the mouse in the MouseMove event, and use that in conjunction with the doubleclick to find out where the mouse is...

Jake
0
 
kevinmeredithAuthor Commented:
can you give me an example please jake?  i'm not familiar with MouseMove
0
 
jake072Commented:
No problem:

I would have a form level variable:

Private ptMousePos as Point

Then in your MouseMove event:

    Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
        ptMousePos = New Point(e.X, e.Y)
    End Sub

Now you have a point of where the cursor is...

You can access the X & Y via ptMousePos.X & .Y :)

Let me know if you need further assistance,

Jake
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
kevinmeredithAuthor Commented:
thanks Jake.  I will try that.  with the holiday weekend, i might not reward you the points or ask any additional questions for a while.  just to let you know.  thanks!
0
 
ctm5Commented:
Jake's suggestion is the way to go if you don't want to get into subclassing or third-party controls. If you are willing to use a third-party control, there are lots. Google ImageMap and VB.

ctm5
0
 
ctm5Commented:
oops, sorry Jake, didn't know you were still around.

ctm5
0
 
jake072Commented:
ctm5 - no worries!

We're all here to help!

Jake
0
 
ctm5Commented:
Yeah, but I hate stepping one someone's toes!
0
 
kevinmeredithAuthor Commented:
that worked awesome Jake!  thanks alot
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now