我想做一个"按钮',当我的鼠标移到位置时我想要的字出现,当我的鼠标离开时字消失???例如:,
   "打开"按钮,当鼠标移到该按钮时,则出现"打开" 

解决方案 »

  1.   

    在按钮的tooltip中输入你想要出现的提示字符串就可以了
      

  2.   


    Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
      Command1.Caption = "打开"
    End Sub'自己不会看看?以为简单就不用负分吗?
      

  3.   

    楼上写的太简单,是错的========================================
    Option Explicit  
    Private Declare Function ReleaseCapture Lib "user32" () As Long
    Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As LongPrivate Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
            If (X < 0) Or (Y < 0) Or (X > Command1.Width) Or (Y > Command1.Height) Then
                ReleaseCapture
                Command1.Caption = ""
            Else
                SetCapture Command1.hwnd
                Command1.Caption = "打开"
            End If
    End Sub
      

  4.   

    楼上稍显复杂,其实可以更简单,只需两个mousemove就可实现:
    Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Command1.Caption = "打开"
    End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Command1.Caption = " "
    End Sub
      

  5.   

    支持用 wxy_xiaoyu(☆然也☆ => .NET 努力ing)的方法,楼上的在鼠标快速移动时不起效。
      

  6.   

    我的方法应该说是彻底的方法 qekong(胡刚) 的方法可行,但是效果不好,而且客观因素较多.例如,如果按钮是在一个容器里面,就要把Form_MouseMove 改为 容器_MouseMove ,不附和代码封装重用的原则