|
-
Mar 18th, 2006, 04:29 PM
#1
Thread Starter
Addicted Member
Which Mouse button
I haev a picture, and I'm currently coding in the picturebox_Clicked method. How can I differentiate between which mouse button is being clicked here and do different tasks..
Ex.
Right button -- msgbox "right"
left button -- msgbox "left"
-
Mar 18th, 2006, 04:30 PM
#2
Hyperactive Member
Re: Which Mouse button
well, you could use a context menu for right clicks. other than that i dont know.
-
Mar 18th, 2006, 04:58 PM
#3
Re: Which Mouse button
 Originally Posted by JohnRChick
I haev a picture, and I'm currently coding in the picturebox_Clicked method. How can I differentiate between which mouse button is being clicked here and do different tasks..
Ex.
Right button -- msgbox "right"
left button -- msgbox "left"
Hi,
You could try this;
VB Code:
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
If e.Button = MouseButtons.Left Then
TextBox1.Text = "Button Left" & Space(1) + CStr(e.X) + "," + CStr(e.Y)
End If
If e.Button = MouseButtons.Right Then
TextBox1.Text = "Button Right" & Space(1) + CStr(e.X) + "," + CStr(e.Y)
End If
End Sub
I couldn't find anything more.
sparrow1
-
Mar 20th, 2006, 10:54 AM
#4
Hyperactive Member
Re: Which Mouse button
Don't use the PictureBox click event use the MouseDown event instead.
VB Code:
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
'get the button that was pressed
'just show it in a label......
lblMouse.Text = e.Button.ToString
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|