给你个例子,可以参考下,在表上建立一个 CommandButton1 和 Label1
代码:
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If X > 0 And X < CommandButton1.Width And _
Y > 0 And Y < CommandButton1.Height Then
hint = "This's Button1"
With Label1
.Caption = hint
.Left = X + CommandButton1.Left
.Top = Y + CommandButton1.Top
.Visible = True
End With
End If
End Sub
Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Label1.Visible = False
End Sub