在.NET中交换鼠标左右键 [英] Swapping left and right mouse button in .NET

查看:82
本文介绍了在.NET中交换鼠标左右键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何我换鼠标左键和右键按钮.NET(preferably C#)?基本上,如果用户通过控制面板检查在鼠标属性的切换主要和次要的按钮复选框的结果应该是一样的。我处理Windows XP中,如果有差别。

How do I swap left and right mouse buttons in .NET (preferably C#)? Basically the result should be the same as if the user checked the "Switch primary and secondary buttons" checkbox in the Mouse Properties through the control panel. I'm dealing with Windows XP, in case that makes a difference.

推荐答案

您可以使用Windows API调用来 SwapMouseButton

You can use a Windows API call to SwapMouseButton:

using System.Runtime.InteropServices;

// ...

[DllImport("user32.dll")]
public static extern Int32 SwapMouseButton(Int32 bSwap);

// ...

// Swap it.
SwapMouseButton(1); 

// Back to normal.
SwapMouseButton(0);

这篇关于在.NET中交换鼠标左右键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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