Need help with MouseMove function inside tabpages
I was having trouble with a mousemove sub in the application I am working on. If I use the following :
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
the program will pick up mouse movements correctly around the perimeter of the tab pages. However, the sub does not respond to movements inside the tab pages. I thought this problem might be because Vb.net uses tabpages instead of tabcontrol to raise the event when the mouse position is inside the tab page, but even if this is the case, I still do not know how to modify the sub to pick up the movements. Could someone help me?
Re: Need help with MouseMove function inside tabpages
well the form_mousemove event ISN'T supposed to capture mouse movement when you move the mouse over controls. It is only raised when the mouse is moved over an empty form area.
If your question is how can you capture the mouse event for each single tab page then I guess you can dynamically add the event for all the tab pages. This adds the MouseMove event to all the tab pages:
VB Code:
Dim i As Integer
For i = 0 To TabControl1.TabCount - 1
AddHandler TabControl1.TabPages(i).MouseMove, AddressOf TabControl1_MouseMove
Next
Private Sub TabControl1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TabControl1.MouseMove End Sub
Re: Need help with MouseMove function inside tabpages
Okay, that works. Thank you.