3个回答
展开全部
在控件上加上鼠标的事件,来监听鼠标按下(mousedown)或者鼠标松开(mouseup)。在鼠标监听事件中判断鼠标的左右键就可以了。
以下是form上加鼠标事件的例子
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Print "点击的是左键"
ElseIf Button = 2 Then
Print "点击的是右键"
End If
End Sub
以下是form上加鼠标事件的例子
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Print "点击的是左键"
ElseIf Button = 2 Then
Print "点击的是右键"
End If
End Sub
展开全部
看是什么控件了,一般在_MouseDown事件写
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
'左键 +1
ElseIf Button = 2 Then
'右键 -1
End If
End Sub
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
'左键 +1
ElseIf Button = 2 Then
'右键 -1
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Dim K As Long
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then '左键
K = K - 1
End If
If Button = 2 Then '右键
K = K + 1
End If
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then '左键
K = K - 1
End If
If Button = 2 Then '右键
K = K + 1
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询