|
-
Jul 18th, 2002, 05:18 PM
#1
Thread Starter
Addicted Member
Mouse Over & Mouse Out Detection
Hi, does anyone know of a good way to detect mouse over and mouse out? Please tell me every possible way to do so because I wanna see which is the fastest. Thank you.
-
Jul 18th, 2002, 05:19 PM
#2
PowerPoster
Well
Inside/outside your application?
Over what type of control?
Please explain more...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Jul 18th, 2002, 05:22 PM
#3
Fanatic Member
well u can find the position of the mouse. u could use this in a loop to find out if it is over the control?
declare this...
VB Code:
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private CursorPoint As POINTAPI
Private mouseX As Single
Private mouseY As Single
then use this...
VB Code:
GetCursorPos CursorPoint
ScreenToClient hwnd, CursorPoint
mouseX = Int(CursorPoint.X * Screen.TwipsPerPixelX)
mouseY = Int(CursorPoint.Y * Screen.TwipsPerPixelX)
debug.Print "Mouse X = " & mousex & vbcrlf & "Mouse Y = " & mouseY
-
Jul 18th, 2002, 05:34 PM
#4
Need-a-life Member
Re: Mouse Over & Mouse Out Detection
Originally posted by INF3RN0666
Hi, does anyone know of a good way to detect mouse over and mouse out? Please tell me every possible way to do so because I wanna see which is the fastest. Thank you.
Are you trying to create some sort of rollover image?
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Jul 18th, 2002, 05:44 PM
#5
New Member
MouseMove
MouseMove is the method used to do this. To detect MouseOut events, just use the MouseMove methods on the Form that the controls lies on. That's what I've always done.
Mike Gagne
Application Developer
OrthoRX, Inc
Plano, TX
-
Jul 18th, 2002, 06:14 PM
#6
Thread Starter
Addicted Member
Thank you for all your help, it's greatly appreciated.
I'll explain what I would like to do in order to get the best sollution. Also I didn't have time posting this thread before and then my Enter Button got stuck and posted 5 threads.
What I'm trying to develop is a Command Button for a big project. This button changes to a user specified color on Mouse Over and returns to the user specified color on Mouse Out. It has other features also, but I won't get into that. Well, I'm going to use this button alot so I'd like the most resource efficient code because programming this entire application in VC++ would be a hassle.
I'll talk about the problem with the MouseMove Event. If the user moves his mouse over the item very quickly and then off the form, it will freeze in the highlighted position. Second of all, there is much coding to be done that way especially with that many controls on one form.
I've seen examples of the Mouse Position API. I'd prefer this way because it's fast and depends on less coding. Then again, I've only seen it run off timers and when there are 30 of these things on one form, that will be a problem. So how would I implement this but in the best way possible?
Thanks once again for your help!
-
Jul 18th, 2002, 06:19 PM
#7
-
Jul 18th, 2002, 06:52 PM
#8
Thread Starter
Addicted Member
Ummm...sorry but it doesn't work :S.
-
Jul 18th, 2002, 06:56 PM
#9
Need-a-life Member
-
Jul 18th, 2002, 07:00 PM
#10
Thread Starter
Addicted Member
Oh ok...That's weird. Well can you add that code to a control you're making and then add the control to a form??
-
Jul 18th, 2002, 07:01 PM
#11
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
|