' Highlight the control.
Private Sub Label1_MouseMove(Button As Integer, Shift As _
Integer, x As Single, y As Single)
If highlighted Then Exit Sub
highlighted = True
Label1.ForeColor = vbRed
Timer1.Enabled = True
End Sub
' See if we should unhighlight the control.
Private Sub Timer1_Timer()
Dim pt As POINTAPI
' See where the cursor is.
GetCursorPos pt
' Translate into window coordinates.
ScreenToClient hwnd, pt
' See if we're still within the control.
If pt.x < Label1.Left Or pt.y < Label1.Top Or _
pt.x > Label1.Left + Label1.Width Or _
pt.y > Label1.Top + Label1.Height _
Then
highlighted = False
Label1.ForeColor = vbBlack
Timer1.Enabled = False
End If
End Sub
|