Simen  S M

Simen S M

  • NA
  • 35
  • 26.6k

Assign mouse clicks to buttons, if mouse 1 or 2 is pressed then a button is pressed

Feb 6 2012 4:51 PM

Hi guys! :)

 

Im using Microsoft Multipoint SDK to do this, and I have come so far now but I cant figure this out.

I have 2 mice connected, if left button on one of the mice is pressed, then button5 is clicked.

I have tried something like this:

 

    Private Sub Button1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
        If e.Button = MouseButtonState.Pressed Then
....
        End If

 

( and getting an error with mousedown at the handles like this: Method 'Private Sub Button1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs)' cannot handle event 'Public Event MouseDown(sender As Object, e As System.Windows.Input.MouseButtonEventArgs)' because they do not have a compatible signature. )

Im not sure if the code above is the right to use..

 

But that code only assign button for one mouse I think. Im going to use two mice here, and want to assign "job" for each mouse.

 Short story: connect 2 mice in the computer and when left button on for example mouse 1 is pressed when a button is clicked. So instead of moving the cursor to each button and press it, I want the cursor to be anywhere on the wpf screen and be able to press buttons connected the mouse clicks.

 

I hope you guys understand what I mean.


Thank you so much for all help!


Attachment: wpfapplication2.rar