检测水平鼠标滚轮运动 [英] Detecting Horizontal Mouse Wheel movement
问题描述
我使用鼠标滚轮在我DOTNET的应用程序,这是我所做过如下: <一href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.mousewheel%28v=VS.80%29.aspx"相对=nofollow> MSDN鼠标滚轮的例子
但在我的应用程序,将是巨大的,也可以使用现有的硬件水平鼠标滚轮了。但是,我怎么可以检测到这是用来在.net中?
问候
-
*解*
覆盖的WinProc捕捉鼠标滚轮事件。
为MustInherit类Win32Messages
公共常量WM_MOUSEHWHEEL作为整数=安培; H20E
通过间谍发现++
末级
受保护的覆盖子的WndProc(为ByRef米作为消息)
MyBase.WndProc(米)
如果m.HWnd&LT;&GT; Me.Handle然后
返回
结束如果
选择案例m.Msg
案例Win32Messages.WM_MOUSEHWHEEL
FireMouseHWheel(m.WParam,m.LParam)
m.Result = DirectCast(1,IntPtr的)
退出选择
案例否则
退出选择
最终选择
结束小组
本的博客文章展示了如何可以添加支持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屋!