Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB6 Label Set hand Cursor

Tags:

vb6

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?

like image 610
Gokul E Avatar asked Jun 19 '13 11:06

Gokul E


2 Answers

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

like image 69
crackalak Avatar answered Sep 19 '22 20:09

crackalak


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
like image 33
unlimit Avatar answered Sep 22 '22 20:09

unlimit