展开全部
'窗体鼠标移动事件代码
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'当鼠标离开标签后还原为起始颜色(假如为灰白色)
Label1.BackColor = &H8000000F
End Sub
'标签鼠标移动事件代码
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'当鼠标指向标签的时候为蓝色
Label1.BackColor = &H8000000D
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'当鼠标离开标签后还原为起始颜色(假如为灰白色)
Label1.BackColor = &H8000000F
End Sub
'标签鼠标移动事件代码
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'当鼠标指向标签的时候为蓝色
Label1.BackColor = &H8000000D
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
只要将改变标签背景颜色的代码写在鼠标移动事件里,再将标签原来的背景颜色代码写在窗体的鼠标移动事件里就可以达到目的。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
'前提是Label1已经在这个范围里面了,不然得死拽了
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If MD = True Then
a = Label1.Left + (X - px)
b = Label1.Top + (Y - py)
If a > 2520 And a < 4560 And b < 3840 And b > 1320 Then
Label1.Move a, b
End If
End If
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If MD = True Then
a = Label1.Left + (X - px)
b = Label1.Top + (Y - py)
If a > 2520 And a < 4560 And b < 3840 And b > 1320 Then
Label1.Move a, b
End If
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询