|
-
May 28th, 2009, 10:02 AM
#1
Thread Starter
Addicted Member
[RESOLVED] If mouse is outside a label Then...
As the title says, is it possible to excecute a line of code when your mouse is over a label, then when it's moved outside the label? I succeded to run a line of code by having your mouse over the label.
Code:
Private Sub Label6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label6.Caption = "-Exit-" 'the label was first "Exit". It's like making a label to a button.
End Sub
If you know how to run a code when the mouse is outside the label, please reply back. Thanks!
I think I am, therefore, I am. I think.
-
May 28th, 2009, 10:38 AM
#2
Re: If mouse is outside a label Then...
Because Label's do not have an .hWnd property, doing what you ask is a bit hit or miss.
Try using the Form_Move event.
-
May 28th, 2009, 10:43 AM
#3
Re: If mouse is outside a label Then...
I would try to identify the boundaries of the label, then use something like this to figure out where the cursor is:
Code:
Dim cur_point As POINTAPI
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Put the above code in your General Declarations.
Code:
GetCursorPos cur_point
Put the above in a timer event and check the current coordinates against the boundaries of the label.
Let me know if that makes sense!
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
|