Re: Mouse Buttons and Labels
if you are handling the mouse clicks in the mousedown (or mousemove ??) event then the button state is available in e.button
i.e.
VB Code:
Private Sub TitleBar_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TitleBar.MouseDown
If e.Button = MouseButtons.Right Then
End If
End Sub
HTH
kevin
Re: Mouse Buttons and Labels
Kevin, I tried your suggestion but couldn't get it to work. I was not able to set up the proper handler for the MouseDown event. In your case, you knew the specific design-time object from which the event occurs, but in my situation I don't know until run-time. I presume there is something I don't know. (What else is new???)
RussCanada
Ontario
Re: Mouse Buttons and Labels
The Control.MouseButtons property is Shared so you shouldn't be calling it on an instance anyway. It indicates which mouse buttons are depressed at that moment. To raise a Click event you must depress and release a mouse button so no buttons will be depressed when the Click event is raised.
You should create your MouseDown and/or Click event handlers but omit the Handles clause. Once you've created your array of Labels you can use nested For loops to traverse the entire matrix and use the AddHandler statement to attach the event handlers to the appropriate events.