你可以自己编写这部分的代码呀!
主要是通过坐标的判断了直到mouse是不是在你规定的范围!

解决方案 »

  1.   

    SetCapture VB声明 
    Declare Function SetCapture Lib "user32" Alias "SetCapture" (ByVal hwnd As Long) As Long 
    说明 
    将鼠标捕获设置到指定的窗口。在鼠标按钮按下的时候,这个窗口会为当前应用程序或整个系统接收所有鼠标输入 
    返回值 
    Long,之前拥有鼠标捕获的窗口的句柄 
    参数表 
    参数 类型及说明 
    hwnd Long,要接收所有鼠标输入的窗口的句柄 
    注解 
    我的理解:与ReleaseCapture函数一起使用,用于判断鼠标离开(mouseleave)事件
     ReleaseCapture VB声明 
    Declare Function ReleaseCapture Lib "user32" Alias "ReleaseCapture" () As Long 
    说明 
    为当前的应用程序释放鼠标捕获 
    返回值 
    Long,TRUE(非零)表示成功,零表示失败 
    注解 
    我的理解:与SetCapture函数一起使用,用于判断鼠标离开(mouseleave)事件 
    'Mouse Capture
    Private Type POINTAPI
        X As Long
        Y As Long
    End Type
    Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function ReleaseCapture Lib "user32" () As Long
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    Dim Pt As POINTAPI
    Private Sub Form_Load()
        'KPD-Team 1999
        'URL: http://www.allapi.net/
        'E-Mail: [email protected]
        'redirect all mouse input to this form
        SetCapture Me.hwnd
    End Sub
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        ReleaseCapture
        SetCapture Me.hwnd
    End Sub
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        'Get the current cursor position
        GetCursorPos Pt
        Me.CurrentX = 0
        Me.CurrentY = 0
        'Clear the screen
        Me.Cls
        Me.Print "Cursor position:"
        'Print the mouse co?rdinates to the form
        Me.Print "X:" + Str$(Pt.X) + " Y:" + Str$(Pt.Y)
        Me.Print " (Press ALT-F4 to unload this form)"
        SetCapture Me.hwnd
    End Sub
    Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        ReleaseCapture
        SetCapture Me.hwnd
    End Sub
      

  2.   

    MOUSEOVER事件:发生在鼠标在它的上面移动的时候;
    MOUSEOUT事件:发生在鼠标从它的上面移出的时候;
    例如:
    Private Sub Label1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
        Select Case Index
            Case 0: Label1(0).ForeColor = &HC00000
                    Label1(1).ForeColor = &H0&
                    Label1(2).ForeColor = &H0&
                    Label1(3).ForeColor = &H0&
            Case 1: Label1(1).ForeColor = &HC00000
                    Label1(0).ForeColor = &H0&
                    Label1(2).ForeColor = &H0&
                    Label1(3).ForeColor = &H0&
            Case 2: Label1(2).ForeColor = &HC00000
                    Label1(0).ForeColor = &H0&
                    Label1(1).ForeColor = &H0&
                    Label1(3).ForeColor = &H0&
            Case 3: Label1(3).ForeColor = &HC00000
                    Label1(0).ForeColor = &H0&
                    Label1(1).ForeColor = &H0&
                    Label1(2).ForeColor = &H0&
        End Select
    End Sub
      

  3.   

    如个简单的吧。
    我在程序中加了一个TEXT控件
    如何实现像TEXT_MOUSEOVER  or  TEXT_MOUSEOUT 这两个事件有知道的吗?
    谢谢了,能够实现马上给分事先如明:我的TEXT是可变的!!!我也试过用MOUSEMOVE事件,再通过判断TEXT的LEFT,TOP,WIDTH,EHIGHT和X,Y进行比较,但达不到预期的效果。
    请帮忙·!!!!!
      

  4.   

    Option ExplicitPrivate Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
    Private Declare Function ReleaseCapture Lib "user32" () As LongPrivate Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
    Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If X > 0 And X < Text1.Width And Y > 0 And Y < Text1.Height Then
            Label1.Caption = "MouseOver"
            SetCapture Text1.hWnd
        Else
            Label1.Caption = "MouseOut"
            ReleaseCapture
        End If
    End Sub
      

  5.   

    Option ExplicitPrivate Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
    Private Declare Function ReleaseCapture Lib "user32" () As LongPrivate Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
    Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If X > 0 And X < Text1.Width And Y > 0 And Y < Text1.Height Then
            Label1.Caption = "MouseOver"
            SetCapture Text1.hWnd
        Else
            Label1.Caption = "MouseOut"
            ReleaseCapture
        End If
    End Sub
      

  6.   

    使用SetCapture这种方法只是一个没办法的办法,因为它受到热键,combox控件等的影响,但没有别得更简单有效的办法。
      

  7.   

    Win98 以后 Use WM_MOUSEHOVER 消息
      

  8.   

    Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
    Private Declare Function ReleaseCapture Lib "user32" () As Long
    Private Sub MyIMG_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        RaiseEvent MouseMove(Button, Shift, X, Y)
     
    在 obj 的 mousemove 事件中加入    Dim MouseEnter As Boolean
        With obj
            MouseEnter = (0 <= X) And (X <= .Width) And (0 <= Y) And (Y <= .Height)
          
            If MouseEnter Then
                SetCapture .hWnd
            If Hot = False Then
                Hot = True
           ‘写入进入事件
                End If        
            Else
                ReleaseCapture
                    .Picture = DefaultImage
                '写入离开事件
                Hot = False
            End If
        End With