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"
Printable View
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"
well, you could use a context menu for right clicks. other than that i dont know.
Hi,Quote:
Originally Posted by JohnRChick
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
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