I have a very simple class (shown below) that monitors the mouse position on a separate thread to see if it is hovering over the same spot for more than a second. I have to do this because the Windows Forms control I am using is an interop COM component
that does not have or implement the MouseHover event.
Anyway, the class that instantiates asrMouseHover (lets call it WinFormMain) adds a handler for the asrMouseHover.MouseIsHovering event. The problem is, when this event is raised and caught, the handler in WinFormMain is running on the same
thread as asrMouseHover. I need it to run on WinFormMain... hence, is it possible for one thread to catch an event thrown by another thread.
Public Class asrMouseHover
Public Event MouseIsHovering(ByVal sender As Object, ByVal e As System.EventArgs)
Private _timer As System.Threading.Timer
Private _xCoord As Int32 = 0
Private _yCoord As Int32 = 0
Public ReadOnly Property XCoord() As Double
Public ReadOnly Property YCoord() As Double
Dim myTimerCallback As System.Threading.TimerCallback = New TimerCallback(AddressOf MyCallbackMethod)
_timer = New System.Threading.Timer(myTimerCallback, Nothing, 1000, 1000)
Sub MyCallbackMethod(ByVal s
View Complete Post