C#切換鼠標(biāo)左右鍵習(xí)慣無需控制面板中修改
更新時(shí)間:2013年02月18日 11:05:18 作者:
本人一直喜歡左手使用鼠標(biāo),偶爾同事會(huì)臨時(shí)操作一下,因?yàn)樗牧?xí)慣是右手,還得在控制面板里進(jìn)行更改,太麻煩了所以就編寫一個(gè)控制臺(tái)程序,雙擊一下即可切換左右鍵,熱愛懶人的你可不要錯(cuò)過了哈
本人一直喜歡左手使用鼠標(biāo),但有時(shí)候同事會(huì)臨時(shí)進(jìn)行操作,還得在控制面板里進(jìn)行更改,比較不便,何不編寫一個(gè)控制臺(tái)程序,雙擊一下即可切換左右鍵
代碼很簡(jiǎn)單:
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);//獲取當(dāng)前鼠標(biāo)設(shè)置狀態(tài)
if (flag == 0)//右手習(xí)慣
{
SwapMouseButton(true);//設(shè)置成左手
}
else//左手習(xí)慣
{
SwapMouseButton(false);//設(shè)置成右手
}
}
}
代碼很簡(jiǎn)單:
復(fù)制代碼 代碼如下:
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);//獲取當(dāng)前鼠標(biāo)設(shè)置狀態(tài)
if (flag == 0)//右手習(xí)慣
{
SwapMouseButton(true);//設(shè)置成左手
}
else//左手習(xí)慣
{
SwapMouseButton(false);//設(shè)置成右手
}
}
}
相關(guān)文章
C#最簡(jiǎn)單的關(guān)閉子窗體更新父窗體的實(shí)現(xiàn)方法
原理就是將子窗體最為對(duì)話框模式彈出,當(dāng)窗體關(guān)閉或取消時(shí)更新主窗體2012-11-11C#/.Net 中快速批量給SQLite數(shù)據(jù)庫(kù)插入測(cè)試數(shù)據(jù)
這篇文章主要介紹了C#/.Net 中快速批量給SQLite數(shù)據(jù)庫(kù)插入測(cè)試數(shù)據(jù),本文直接給出實(shí)例代碼,需要的朋友可以參考下2015-06-06