有没有办法检测侧鼠标按钮在C#中按下?

发布于 2025-02-05 02:29:34 字数 70 浏览 3 评论 0 原文

有没有办法检测侧鼠标按钮在C#中按下(例如,鼠标5)?

不使用任何外部库将是最好的方法,但这不会成为世界的尽头。

Is there a way to detect a side mouse button press in c# (For example, Mouse 5)?

without using any external libraries would be the best method, but it wont be the end of the world.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

短暂陪伴 2025-02-12 02:29:35

在任何控制事件方法Mousedown上创建。
此方法中的第二种方法参数将是具有更改属性的鼠标ButtoneVentargs。

更换纽扣是一个被按下的鼠标按钮。

在您的情况下,按钮5将是xbutton2。

Create on any control event method MouseDown.
Second method arguments in this method will be MouseButtonEventArgs which has property ChangedButton.

ChangedButton is a mouse button that was pressed.

In your case side button 5 will be XButton2.

https://learn.microsoft.com/en-us/dotnet/api/system.windows.input.mousebutton?view=windowsdesktop-6.0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文