P
Paul Martin
Hi all
I have found an alternative solution to the problem of a suitable
cursor to emulate a hyperlink. I have a label with a Click event, and
I want the cursor to look like the hand over a hyperlink in Internet
Explorer.
I've tried the hyperlink cursor solution provided by John Walkenbach
and others, but I don't really like the cursor image (nor have I been
able to find one I like).
I found another solution on Google that others might find useful,
because the cursor appears to be the IE cursor.
The first block of code goes into a module:
Public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" _
(ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Public Declare Function SetCursor Lib "user32" _
(ByVal hCursor As Long) As Long
Public Const IDC_HAND = 32649&
Public Const IDC_ARROW = 32512&
Public Sub SetHandCur(Hand As Boolean)
If Hand = True Then
SetCursor LoadCursor(0, IDC_HAND)
Else
SetCursor LoadCursor(0, IDC_ARROW)
End If
End Sub
_________________________________________________________
Then, on the UserForm for the label (or relevant control) MouseMove
and MouseDown events:
SetHandCur True
When the cursor is over the control, the cursor changes, and using the
MouseDown event ensures that the cursor does not revert to default
when clicking a mouse button.
Regards
Paul Martin
Melbourne, Australia
I have found an alternative solution to the problem of a suitable
cursor to emulate a hyperlink. I have a label with a Click event, and
I want the cursor to look like the hand over a hyperlink in Internet
Explorer.
I've tried the hyperlink cursor solution provided by John Walkenbach
and others, but I don't really like the cursor image (nor have I been
able to find one I like).
I found another solution on Google that others might find useful,
because the cursor appears to be the IE cursor.
The first block of code goes into a module:
Public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" _
(ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Public Declare Function SetCursor Lib "user32" _
(ByVal hCursor As Long) As Long
Public Const IDC_HAND = 32649&
Public Const IDC_ARROW = 32512&
Public Sub SetHandCur(Hand As Boolean)
If Hand = True Then
SetCursor LoadCursor(0, IDC_HAND)
Else
SetCursor LoadCursor(0, IDC_ARROW)
End If
End Sub
_________________________________________________________
Then, on the UserForm for the label (or relevant control) MouseMove
and MouseDown events:
SetHandCur True
When the cursor is over the control, the cursor changes, and using the
MouseDown event ensures that the cursor does not revert to default
when clicking a mouse button.
Regards
Paul Martin
Melbourne, Australia