MouseWheel,确定向上和向下滚动事件
有什么方法可以使用子组件上的鼠标滚轮处理程序来确定鼠标是否向上或向下滚动?例如,
Private Sub PictureBox1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
if mousewheel.scrollup then
UserZoom = UserZoom + 0.05
Me.Refresh()
end if
End Sub
我希望能够根据鼠标是否向上或向下滚动来向上或向下调整 userzoom 的值。任何帮助将不胜感激
Is there any way to determine if the mouse scrolls up or down using the Mousewheel handler on a sub? eg
Private Sub PictureBox1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
if mousewheel.scrollup then
UserZoom = UserZoom + 0.05
Me.Refresh()
end if
End Sub
I want to be able to adjust the value of userzoom up or down according to if the mouse is wheeled up or down. Any help would be appreciated guys
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查 MouseEventArgs 的 Delta 属性:
示例代码:
Check the Delta property of the MouseEventArgs:
Sample code:
想通了。
e.delta
根据鼠标向上或向下滚动来传递负值或正值!Figured it out.
e.delta
passes either negative or positive values according to if the mouse is scrolled up or down!