Private WithEvents mTimer As Timer
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
mTimer = New Timer()
mTimer.Interval = 200
mTimer.Enabled = True
End Sub
Private Sub mTimer_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles mTimer.Tick
Dim CursorPosition As Point = PointToScreen(Cursor.Position)
Dim Control1Bounds As New Rectangle(ImageContainer1.PointToScreen(Control1.Location), Control1.Size)
Dim Control2Bounds As New Rectangle(ImageContainer2.PointToScreen(Control2.Location), Control1.Size)
If Control1Bounds.Contains(CursorPosition) Then
Control1.Focus()
ElseIf Control2Bounds.Contains(CursorPosition) Then
Control1.Focus()
End If
End Sub
No comments:
Post a Comment