isnoend2001
asked on
Mousepointer in a textbox- picturebox vb6
I have a textbox in a moveable picture box and want to change the mousepointer to vbdefault when over the textbox.The picturebox is set to size(5) in properties, but it will not change to default
Private Sub txtNotes_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
txtNotes.MousePointer = vbDefault
End Sub
Private Sub picNotes_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'move the picturebox
If Button = vbLeftButton Then
picNotes.Move picNotes.Left + (X - NoteDragX), picNotes.Top + (Y - NoteDragY)
End If
End Sub
How to to this ?
Private Sub txtNotes_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
txtNotes.MousePointer = vbDefault
End Sub
Private Sub picNotes_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'move the picturebox
If Button = vbLeftButton Then
picNotes.Move picNotes.Left + (X - NoteDragX), picNotes.Top + (Y - NoteDragY)
End If
End Sub
How to to this ?
ASKER
Thanks vb_elmar, but in looking at your code
I want the textbox to vbdefault not a custom cursor
txtNotes.MouseIcon = LoadPicture("C:\mycursor.c ur")
txtNotes.MousePointer = 99 '99=Custom Mousepointer
I want the textbox to vbdefault not a custom cursor
txtNotes.MouseIcon = LoadPicture("C:\mycursor.c
txtNotes.MousePointer = 99 '99=Custom Mousepointer
Alternatively you can try this:
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Sub Form_Load()
hWndChild = txtNotes.hWnd
hWndNewParent = picNotes.hWnd
SetParent hWndChild, hWndNewParent
End Sub
Private Sub txtNotes_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'''''txtNotes.MousePointer = vbDefault
End Sub
Private Sub picNotes_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'move the picturebox
If Button = vbLeftButton Then
picNotes.Move picNotes.Left + (X - NoteDragX), picNotes.Top + (Y - NoteDragY)
End If
End Sub
ASKER
Hi vb_elmar
I get an error see below
hWndChild = txtNotes.hwnd 'error variable not defined here
hWndNewParent = picNotes.hwnd
SetParent hWndChild, hWndNewParent
I get an error see below
hWndChild = txtNotes.hwnd 'error variable not defined here
hWndNewParent = picNotes.hwnd
SetParent hWndChild, hWndNewParent
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
I'm always glad when I can help.
Open in new window