1个回答
展开全部
在代码中加入以下事件代码即可让鼠标滚轮支持VScrollBar:
Private Sub mouse_wheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
If e.Delta = 120 Then
If VScrollBar1.Value - VScrollBar1.SmallChange >= 0 Then
VScrollBar1.Value -= VScrollBar1.SmallChange
ElseIf VScrollBar1.Value - 1 >= 0 Then
VScrollBar1.Value -= 1
End If
Else
If VScrollBar1.Value + VScrollBar1.SmallChange <= VScrollBar1.Maximum Then
VScrollBar1.Value += VScrollBar1.SmallChange
ElseIf VScrollBar1.Value + 1 <= VScrollBar1.Maximum Then
VScrollBar1.Value += 1
End If
End If
End Sub
Private Sub mouse_wheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
If e.Delta = 120 Then
If VScrollBar1.Value - VScrollBar1.SmallChange >= 0 Then
VScrollBar1.Value -= VScrollBar1.SmallChange
ElseIf VScrollBar1.Value - 1 >= 0 Then
VScrollBar1.Value -= 1
End If
Else
If VScrollBar1.Value + VScrollBar1.SmallChange <= VScrollBar1.Maximum Then
VScrollBar1.Value += VScrollBar1.SmallChange
ElseIf VScrollBar1.Value + 1 <= VScrollBar1.Maximum Then
VScrollBar1.Value += 1
End If
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询