VB如何判断鼠标指针是否指着按钮
我想自己制作按钮,用一个标签控件,鼠标指向它时背景为绿色,点击它为黄色,鼠标不指向它时为红色。(就是跟按钮一样了,只不过用代码体现)其实我最关心的是如何判断鼠标指针是否指...
我想自己制作按钮,用一个标签控件,鼠标指向它时背景为绿色,点击它为黄色,鼠标不指向它时为红色。(就是跟按钮一样了,只不过用代码体现)其实我最关心的是如何判断鼠标指针是否指着它,因为这是自制按钮的关键。谢谢! (就是按钮效果啦!用form1_mousemove是不行的!!!!!!!!!!!!!!!!)(标签放在窗口边缘,假如鼠标马上移动出了窗口范围,form1_mousemove就会无效了)
展开
展开全部
Option Explicit
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.BackColor = &H80000008
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.BackColor = &H8000000A
End Sub
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.BackColor = &H80000009
End Sub
颜色你自己调,这只是一个示范
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.BackColor = &H80000008
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.BackColor = &H8000000A
End Sub
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.BackColor = &H80000009
End Sub
颜色你自己调,这只是一个示范
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询