如果用API,你可以使用钩子
如果不想用API,你可以在它下面放一个略大一点的PictureBox,使用它们的MouseMove来判断

解决方案 »

  1.   

    Public Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
    Public Declare Function ReleaseCapture Lib "user32" () As Long
      

  2.   

    RE:PictureBox,使用它们的MouseMove来判断
    这种方法不好,有时,鼠标移快了。MouseMove事件不触发。就用 victorfen(小B) 说的两个API吧。Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        With PicShow 'Change this to the name of the control
            If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
            'Mouse pointer is outside button, so let other controls receive
            'mouseevents too:
            ReleaseCapture
            ' 放入鼠标离开的代码        
            Else
            ' Mouse pointer is over button, so we'll capture it, thus
            ' we'll receive mouse messages even if the mouse pointer is
            ' not over the button
            SetCapture .hwnd
            ' 放入鼠标进入的代码
            End If
        End With
    End Sub
      

  3.   

    up to lyqof908(刘运祥) !
      

  4.   

    lyqof908(刘运祥) 的方法很正确的~~~只是在提示鼠标所在位置时切记不要用MSGBOX ~
      

  5.   


    http://www.dahpa.net/bbs
    中有完整的检测鼠标的离子!