检测水平鼠标轮移动 [英] Detecting Horizontal Mouse Wheel movement

查看:129
本文介绍了检测水平鼠标轮移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的DotNet应用程序中使用了鼠标滚轮,我已经通过以下操作完成了:
显示如何添加对WinForms应用程序的支持。


I am using the mousewheel in my DotNet application, which I have done by following: MSDN MouseWheel example

But on my application it would be great to also use the existing hardware horizontal mouse wheel too. But how can I detect when this is used in .Net?

I am using Logitech RX1500 or or m-RAG97.

Regards

-

* Solution *

Override the WinProc to catch the mouse wheel event.

MustInherit Class Win32Messages
    Public Const WM_MOUSEHWHEEL As Integer = &H20e
    'discovered via Spy++
End Class



Protected Overrides Sub WndProc(ByRef m As Message)
    MyBase.WndProc(m)
    If m.HWnd <> Me.Handle Then
        Return
    End If
    Select Case m.Msg
        Case Win32Messages.WM_MOUSEHWHEEL
            FireMouseHWheel(m.WParam, m.LParam)
            m.Result = DirectCast(1, IntPtr)
            Exit Select
        Case Else
            Exit Select

    End Select
End Sub

解决方案

This blog post shows how you can add support to a WinForms application.

这篇关于检测水平鼠标轮移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆