|
-
Dec 13th, 1999, 01:28 PM
#1
Thread Starter
Lively Member
ok, with most controls, they have; MouseDown, MouseMove, and MouseUp. that doesn't do me much good, is there anyway to have it act as a MouseEnter/MouseExit event? Please help.
Example would be, you put your mouse over a picbox, and it changes to a different picture, move the mouse off the picbox, and it would change back.
-
Dec 13th, 1999, 04:19 PM
#2
Lively Member
Here's a bit of code that changes the caption of a command button as the mouse is moved onto & off the button. Should be the same for a PictureBox control.
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.Caption = "ON"
End Sub
Private Sub Form_MouseMove(Button As Integer
, Shift As Integer, X As Single, Y As Single)
Command1.Caption = "OFF"
End Sub
-
Dec 13th, 1999, 06:27 PM
#3
That only works if you move the mouse over the form(after you where above the button) it doesn't work if you move over another control(or move real fast).
The only decent way i found to this kinda thing is with the GetCurserPos api.
------------------
Vincent van den Braken
EMail: [email protected]
ICQ: 15440110
Homepage: http://www.azzmodan.demon.nl
-
Dec 13th, 1999, 06:42 PM
#4
You can use the SetCapture API function. Here's an example using a command button:
'Form Code
Option Explicit
Private Declare Function SetCapture _
Lib "user32" ( _
ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture _
Lib "user32" () As Long
Private blnHasCapture As Boolean
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If blnHasCapture = False Then
Call SetCapture(Command1.hwnd)
blnHasCapture = True
End If
If (X < 0 Or X > Command1.Width) Or (Y < 0 Or Y > Command1.Height) Then
Command1.Caption = "Off"
Call ReleseCapture()
blnHasCapture = False
Else
Command1.Caption = "On"
End If
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If blnHasCapture Then
Call SetCapture(Command1.hwnd)
End If
End Sub
Good luck!
------------------
Joacim Andersson
[email protected]
[email protected]
www.YellowBlazer.com
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
|