新建一个工程,再添加一个窗体。在Form2上添加一个标签。在form1上添加一个按钮,将下面代码复制到form1的代码窗口
Dim Bj As Boolean
Private Sub Command1_Click()
Unload Form2
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Bj = False Then
MyMsgbox "怎么样,我弹出来了!", "弹出窗口"
Bj = True
End If
End Sub
Private Sub Form_Load()
Bj = False
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Bj = False
End Sub
Private Sub MyMsgbox(Optional Ts As String, Optional Bt As String)
On Error Resume Next
Form2.Label1 = Ts
Form2.Caption = Bt
Form2.Show
End Sub
设置这个按钮的 ToolTiptext 的值为提示内容即可。
如:command1.tooltiptext="提示信息"
按钮有个GotFocus事件
在这个事件里写个弹出信息就可以了。
如果你用的是标准控件,那里控件里面有一个参数是用来干这个活的,你自己找一下吧,我不记得是哪个了