|
-
Jan 13th, 2003, 08:34 AM
#1
Thread Starter
Fanatic Member
mouse move
My form contains a label and a textbox
What i want is , when my mouse moves over the textbox ,
label should show a text message , and show blank when the mouse is no longer on the textbox.
i used the mousemove event of the textbox and form , but in case another textbox is placed close to this textbox , and if i immediately takes the mouse to this second textbox , label does not get blank .
Any solutions ?
Thanks.
-
Jan 13th, 2003, 08:38 AM
#2
VB Code:
Option Explicit
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetCapture Lib "user32" () As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
With Text1
If ((X < 0) Or (X > .Width) Or (Y < 0) Or (Y > .Height)) Then 'MouseOut
Call ReleaseCapture
Label1.Caption = "Mouse Out!"
ElseIf GetCapture <> .hwnd Then 'MouseEnter
Call SetCapture(.hwnd)
Label1.Caption = "Mouse Enter!"
Else
'Mouse Move
End If
End With
End Sub
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jan 13th, 2003, 01:29 PM
#3
Member
how do i do the same thing to image box instead of using text box???
i tried this code with image box and itz saying error.
-
Jan 13th, 2003, 01:34 PM
#4
For future reference, you might want to start off with what the error is. 
However, in this case, I know what it is. Imageboxes do not have a hWnd property, which this method relies on to work. There have been a couple ways posted before on how to get around this using controls without hWnds.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|