VB6.0中鼠标移动至一个按钮上后触发一个事件怎么实现

来源:百度知道 编辑:UC知道 时间:2024/05/30 11:03:00
大概就题目那样..

用该按钮的mousemove事件,在过程中写出你要做的事情,不复杂

只能用窗体的鼠标移动事件了!
画出一个按钮,command1

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If X > Command1.Left And X < Command1.Left + Command1.Width And Y > Command1.Top And Y < Command1.Top + Command1.Height Then
Command1.Visible = True
Else: Command1.Visible = False
End If
End Sub

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

写你要的事件

End Sub

代码如下。
======
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MsgBox "你的鼠标移动到按钮上了"
End Sub