10分 VB 程序运行时,如何做到:当鼠标指针指向 Command1 时,Label1 显示 Command1?

来源:百度知道 编辑:UC知道 时间:2024/06/26 00:12:01
满意答案给分 谢谢!
Label1的MOUSE_MOVE可以,但是当鼠标指针不指向 Command1 时,Label1 还是显示 Command1.如何清空?

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.Caption = "command1"
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.Caption = ""
End Sub

在form的MOUSE_MOVE里写
if x>command1.left and x<command1.left+command1.width and y>command1.top and y<command1.top+command1.height then
Label1.Caption = "command1"
else
Label1.Caption = ""
end if

用鼠标移动的事件就可以了,Label1的MOUSE_MOVE