Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hand.ico image

Status
Not open for further replies.

eramgarden

Programmer
Aug 27, 2003
279
US

I have a small VB app with 3 links on it. When I scroll mouse over it, i want it to change to "hand", just like in web.

I chose "custom" in "mouse pointer" property, but where can I find that image?

Thanks for any leads.
 
In your visual studio folder you should find a cursor called H_Point.cur. Then change your Mouse Pointer to Custom and Mouse Icon to H_Point.cur.

\Microsoft Visual Studio\Common\Graphics\Cursors\H_POINT.CUR
 
You can do it with a toolbar
property aleign vbNoAleign

And the property HotListImage contains the image you will see when mouse if on the object.

peterguhl@yahoo.de
 
Tell ya what...try out this little bit of code. It may be a little long winded for what you want to do but it does add a LOT of functionality.

To try this code, simply start a new project and create a new form. In this form create 1 Text Box (Text1), and four Labels (NO Control Array - Label1, Label2, etc).

Now place the code blow into the declarations section of your new form and let er rip...

'*** CODE STARTS HERE *******
'API used to set the predetermined Windows mouse pointer.
Private Declare Function LoadCursorBynum Lib "user32" Alias "LoadCursorA" _
(ByVal hInstance As Long, ByVal lpCursorName As Long) As Long

'API used to Load in a custom Cursor. These are Mouse pointers
'that can follow your application package.
Private Declare Function LoadCursorFromFile Lib "user32" Alias _
"LoadCursorFromFileA" (ByVal lpFileName As String) As Long

'API used to display the Mouse Pointer.
Private Declare Function SetCursor Lib "user32" _
(ByVal hCursor As Long) As Long

'Constants of 'in-house' predetermined Windows
'Mouse pointers already in use by Windows.
Const IDC_APPSTARTING = 32650&
Const IDC_HAND = 32649&
Const IDC_ARROW = 32512&
Const IDC_CROSS = 32515&
Const IDC_IBEAM = 32513&
Const IDC_ICON = 32641&
Const IDC_NO = 32648&
Const IDC_SIZE = 32640&
Const IDC_SIZEALL = 32646&
Const IDC_SIZENESW = 32643&
Const IDC_SIZENS = 32645&
Const IDC_SIZENWSE = 32642&
Const IDC_SIZEWE = 32644&
Const IDC_UPARROW = 32516&
Const IDC_WAIT = 32514&
'====================================================

Function MouseCursor(CursorType As Long)
'Display a Windows mouse pointer.
'usage: MouseCursor IDC_HAND

'Set the mouse pointer.
Dim lngRet As Long
lngRet = LoadCursorBynum(0&, CursorType)

'Display the Mouse Pointer
lngRet = SetCursor(lngRet)

End Function

'====================================================

Function PointM(strPathToCursor As String) As Boolean
'Display any mouse Pointer Cursor
'usage: PointerM App.Path & "\H_IBEAM.CUR"

'Load in a custom mouse pointer
Dim lngRet As Long
lngRet = LoadCursorFromFile(strPathToCursor)
'Display the Mouse Pointer
lngRet = SetCursor(lngRet)
PointM = Not PointM
End Function
'====================================================

Private Sub Form_Load()
Me.Label1.Caption = " Me.Label1.ForeColor = vbBlue
Me.Label1.Font.Underline = True

Me.Label2.Caption = " Me.Label2.ForeColor = vbBlue
Me.Label2.Font.Underline = True

Me.Label3.Caption = " Me.Label3.ForeColor = vbWhite
Me.Label3.Font.Underline = True

Me.Label4.Caption = " Me.Label4.ForeColor = vbRed
Me.Label4.Font.Underline = True
End Sub

Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseCursor IDC_HAND
End Sub

Private Sub Label2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseCursor IDC_HAND
End Sub

Private Sub Label3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseCursor IDC_WAIT
End Sub

Private Sub Label4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseCursor IDC_NO
End Sub

Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Locate the H_IBEAM.CUR custom mouse cursor
'and copy it to your project folder or, supply
'the PointM function the full path and name
'to where it is located. In MS Visual Studio this
'would be:
'\Microsoft Visual Studio\Common\Graphics\Cursors\H_IBEAM.CUR
If Not PointM(App.Path & "\H_IBEAM.CUR") Then MouseCursor IDC_IBEAM
End Sub
'**** CODE END HERE ****

Ummm...I hope this helps ya a little
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top