VB 如何判断鼠标状态
1个回答
展开全部
'''窗体上添加一个Label, 一个Timer1
Option Explicit
Private btnFlag As Boolean, mButton As Integer
Private Sub Form_Load()
Label1.Caption = "未按下鼠标任何键"
Label1.AutoSize = True
Timer1.Enabled = False
Timer1.Interval = 800 '鼠标按住800毫秒以上判断为鼠标处理按住状态, 可以根据具体需要调整End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Enabled = True
mButton = Button
btnFlag = TrueEnd SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
btnFlag = False
Option Explicit
Private btnFlag As Boolean, mButton As Integer
Private Sub Form_Load()
Label1.Caption = "未按下鼠标任何键"
Label1.AutoSize = True
Timer1.Enabled = False
Timer1.Interval = 800 '鼠标按住800毫秒以上判断为鼠标处理按住状态, 可以根据具体需要调整End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Enabled = True
mButton = Button
btnFlag = TrueEnd SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
btnFlag = False
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询