C#切換鼠標左右鍵習慣無需控制面板中修改
更新時間:2013年02月18日 11:05:18 作者:
本人一直喜歡左手使用鼠標,偶爾同事會臨時操作一下,因為他的習慣是右手,還得在控制面板里進行更改,太麻煩了所以就編寫一個控制臺程序,雙擊一下即可切換左右鍵,熱愛懶人的你可不要錯過了哈
本人一直喜歡左手使用鼠標,但有時候同事會臨時進行操作,還得在控制面板里進行更改,比較不便,何不編寫一個控制臺程序,雙擊一下即可切換左右鍵
代碼很簡單:
class Program
{
[DllImport("user32.dll")]
private extern static bool SwapMouseButton(bool fSwap);
//博客地址:http://blog.csdn.net/bluceyoung
[DllImport("user32.dll")]
private extern static int GetSystemMetrics(int index);
static void Main(string[] args)
{
int flag = GetSystemMetrics(23);//獲取當前鼠標設置狀態(tài)
if (flag == 0)//右手習慣
{
SwapMouseButton(true);//設置成左手
}
else//左手習慣
{
SwapMouseButton(false);//設置成右手
}
}
}
代碼很簡單:
復制代碼 代碼如下:
class Program
{
[DllImport("user32.dll")]
private extern static bool SwapMouseButton(bool fSwap);
//博客地址:http://blog.csdn.net/bluceyoung
[DllImport("user32.dll")]
private extern static int GetSystemMetrics(int index);
static void Main(string[] args)
{
int flag = GetSystemMetrics(23);//獲取當前鼠標設置狀態(tài)
if (flag == 0)//右手習慣
{
SwapMouseButton(true);//設置成左手
}
else//左手習慣
{
SwapMouseButton(false);//設置成右手
}
}
}
相關文章
C#/.Net 中快速批量給SQLite數(shù)據庫插入測試數(shù)據
這篇文章主要介紹了C#/.Net 中快速批量給SQLite數(shù)據庫插入測試數(shù)據,本文直接給出實例代碼,需要的朋友可以參考下2015-06-06