|
-
Jun 1st, 2000, 09:17 PM
#1
Thread Starter
Addicted Member
Is there a way I can intercept a form based event from inside a usercontrol?
Ie: Snag the mouse move event for the form from inside a usercontrol?
EireDrake
-
Jun 1st, 2000, 09:34 PM
#2
transcendental analytic
Are you making a rollover effect?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 2nd, 2000, 01:48 AM
#3
Thread Starter
Addicted Member
Roll over
Basically I'm trying to detect when the mouse is over the control or over the form from within the control...
I'm basically trying to create a Command Button which highlights it's text when the cursor is over it OR changes it's image when the cursor is over it.
And yes I know that there are controls already out there but I have some specifications I want in the control. So what I need to be able to do is detect when the Mouse Cursor is no longer over the control in order to let the control know when to switch back. I'd prefer to avoid using the mouse API's because I don't feel like having to compute the control position based on the screen.
Ie: Usercontrol_Mouse_Move(blah)
Text1.forecolor=VBRED
end
Form1_Mouse_Move(Blah)
text1.forecolor=VBBLACK
end
-
Jun 2nd, 2000, 05:42 AM
#4
transcendental analytic
I'm confused... Why would you like to avoid api as i have the perfect solution for you, using it?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 2nd, 2000, 06:01 AM
#5
Thread Starter
Addicted Member
API
Don't get me wrong... ANY solution is better than no solution. I was just hoping there was a way to do it without an API...Whatcha got? I'll put it to use if it's what I'm looking for...
Thanks,
EireDrake
-
Jun 2nd, 2000, 06:51 AM
#6
transcendental analytic
Of course you can do it without api, but never as a usercontrol, you have to subclass and ****.
No, you have to get the mouseposition and the usercontrol wnd's Rect. using these:
Code:
Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long
Type POINTAPI
x As Long
y As Long
End Type
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Get the wnd of your usercontrol and get it's rect, then get the mousecursor pointapi and compare the it with the rect and see if they fit, if not, you're mouse exiting - this has to be done in a timer. Turn of the timer when your mouse exits and when it enters by triggering mousemove event, you enable the timer again.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
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
|