How to Set hand Cursor for a Label Control in Visual Basic 6
My label should act like a Link button.
I changed the ForeColor
to vbBlue
, Underline Style and so on..
now I have to set the Hand cursor for that Label.. How to do it?
You can use API calls to get the system hand cursor
Put the following code in a module
Public Const IDC_HAND = 32649&
Public Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long
Public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
and in the MouseMove event of the label, put the following code
SetCursor LoadCursor(0, IDC_HAND)
Other cursor constants: http://msdn.microsoft.com/en-us/library/windows/desktop/ms648391%28v=vs.85%29.aspx
You will have to do a custom MouseIcon
. You will find a hand cursor in the graphics folder of your Visual Studio 6 installation. Here is the code to do it:
Private Sub Form_Load()
Label1.MousePointer = vbCustom
Label1.MouseIcon = LoadPicture("C:\Program Files\Microsoft Visual Studio\Common\Graphics\Cursors\H_POINT.cur")
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With