




下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、1田日一個(gè)鼠標(biāo)類#region 一個(gè)鼠標(biāo)類2:4 /*/ <summary>3 /Mouse Control4 /Made by Michael5 /date 2008-01-306 /</summary>7 class Mouse8 呻 -“9 internal const byte SM_MOUSEPRESENT = 19;10 internal const byte SM_CMOUSEBUTTONS = 43;11 I internal const byte SM_MOUSEWHEELPRESENT = 75;1213 internal struct POINTA
2、PI14中申 15 internal int x;16 internal int y;17 )1819 internal struct RECT20i 21 Iinternal int left;22 Iinternal int top;23 Iinternal int right;24 Iinternal int bottom;251)26 I27 ISystem.Runtime.InteropServices.DllImportCuser32.dll", EntryPoint = "SwapMouseButton")28 I internal extern s
3、tatic int SwapMouseButton(int bSwap);2930 I System.Runtime.InteropServices.DllImport("user32", EntryPoint = "ClipCursor")31 I internal extern static int ClipCursor(ref RECT lpRect);32 I33 ISystem.Runtime.InteropServices.DllImportCuser32.dll", EntryPoint = "GetCursorPos&
4、quot;)34 I internal extern static int GetCursorPos(ref POINTAPI lpPoint);3536 ISystem.Runtime.InteropServices.DllImportCuser32.dll", EntryPoint = "ShowCursor")37 I internal extern static bool ShowCursor(bool bShow);38 39 ISystem.Runtime.InteropServices.DllImportCuser32.dll", Entr
5、yPoint = "EnableWindow")40 I internal extern static int EnableWindow(int hwnd, int fEnable);4142 System.Runtime.InteropServices.DllImportduser32.dll", EntryPoint = "GetWindowRect")43 I internal extern static int GetWindowRect(int hwnd, ref RECT lpRect);44 I45 System.Runtime.
6、InteropServices.DllImportCuser32.dll", EntryPoint = "SetCursorPos")46 | internal extern static int SetCursorPos(int x, int y);47 I48 System.Runtime.InteropServices.DllImportduser32.dll", EntryPoint = "GetSystemMetrics")49 I internal extern static int GetSystemMetrics(in
7、t nIndex);50 I51 ISystem.Runtime.InteropServices.DllImportCuser32.dll", EntryPoint = "SetDoubleClickTime")52 I internal extern static int SetDoubleClickTime(int wCount);53 I54 System.Runtime.InteropServices.DllImportCuser32.dll", EntryPoint = "GetDoubleClickTime")55 I i
8、nternal extern static int GetDoubleClickTime();5657 ISystem.Runtime.InteropServices.DllImportCkernel32.DLL", EntryPoint = "Sleep")58 I internal extern static void Sleep(int dwMilliseconds);5960 I得到鼠標(biāo)相對與全屏的坐標(biāo),不是相對與你的Form的,且與你的分辨率有關(guān)系6162public static int FullScreenPosition_X63甘641get65i
9、66POINTAPI _POINTAPI = new POINTAPI();6768GetCursorPos(ref _POINTAPI);6970 return _POINTAPI.x;71 I 72173 I74 public static int FullScreenPosition_Y75 丁 3761get77丁;78POINTAPI _POINTAPI = new POINTAPI();7980GetCursorPos(ref _POINTAPI);8182 Ireturn _POINTAPI.y;8311841)8586 |/隱藏顯示鼠標(biāo)87 Ipublic static voi
10、d Hide()88;主891 ShowCursor(false);901)9192 I public static void Show()93J 941 ShowCursor(true);951)9697 將鼠標(biāo)鎖定在你的Form里 不過你得將你的 Form先鎖了,F(xiàn)orm Resize就失效98 I public static void Lock(System.Windows.Forms.Form ObjectForm)99J 100RECT _FormRect = new RECT();101102GetWindowRect(ObjectForm.Handle.ToInt32(), re
11、f _FormRect);103104ClipCursor(ref _FormRect);1051)106107 Ipublic static void UnLock()1080巾 109RECT _ScreenRect = new RECT();110111 _ScreenRect.top = 0;112 _ScreenRect.left = 0;113 _ScreenRect.bottom =System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom;114 _ScreenRect.right = System.Windows.
12、Forms.Screen.PrimaryScreen.WorkingArea.Right;115116 ClipCursor(ref _ScreenRect);117l )118119鼠標(biāo)失效,不過失效的好像不只是鼠標(biāo),小心哦120 public static void Disable(System.Windows.Forms.Form ObjectForm)121中中 122EnableWindow(ObjectForm.Handle.ToInt32(), 0);1231)124125 Ipublic static void Enable(System.Windows.Forms.Form
13、ObjectForm)126中本 127 IEnableWindow(ObjectForm.Handle.ToInt32(), 1);128 卜129 /得到你的鼠標(biāo)類型130 Ipublic static string Type131 就 . 1321get133 處134 |if (GetSystemMetrics(SM_MOUSEPRESENT) =0)135巾中136return"本計(jì)算機(jī)尚未安裝鼠標(biāo)"13711381else1390本140if (GetSystemMetrics(SM_MOUSEWHEELPRESENT) != 0)1410中142returnG
14、etSystemMetrics(SM_CMOUSEBUTTONS)+ "鍵滾輪鼠標(biāo)”14311441else145巾中146returnGetSystemMetrics(SM_CMOUSEBUTTONS)+ "鍵鼠標(biāo)"1471148114911501151152/設(shè)置鼠標(biāo)雙擊時(shí)間153 public static void DoubleClickTime_Set(int MouseDoubleClickTime)154巾巾 ,155156157158159中160161 I162163164165中166SetDoubleClickTime(MouseDoubleClickTime); public static string DoubleClickTime_Get()return GetDoubleClickTime(
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 冊訂購合同標(biāo)準(zhǔn)文本
- 公司食堂物業(yè)合同樣本
- 鄉(xiāng)村振興招標(biāo)合同標(biāo)準(zhǔn)文本
- 2025年天津市和平區(qū)高三語文一模試題卷附答案解析
- 家校合作溝通機(jī)制計(jì)劃
- 公司司機(jī)簡易合同標(biāo)準(zhǔn)文本
- 出售塔吊電梯合同樣本
- 涼山物業(yè)服務(wù)合同樣本
- 出兌店合同標(biāo)準(zhǔn)文本
- 2025年深圳市簡易房屋裝修合同
- 2025購銷商品合同模板
- 2024年山西華陽新材料科技集團(tuán)有限公司招聘筆試真題
- 2025年03月春季甘肅臨夏州引進(jìn)高層次人才和急需緊缺專業(yè)技術(shù)人才344人筆試歷年參考題庫考點(diǎn)剖析附解題思路及答案詳解
- 上海市第一至十八屆高一物理基礎(chǔ)知識競賽試題及答案
- 城市設(shè)計(jì)導(dǎo)則SOM
- C語言程序設(shè)計(jì)題庫習(xí)集帶答案(128p最全版)
- 高爐布袋除塵的MCGS-PLC控制系統(tǒng)
- 反三違培訓(xùn)課件
- 河北醫(yī)療機(jī)構(gòu)另收費(fèi)用一次性物品管理目錄
- 老橋拆除監(jiān)理實(shí)施細(xì)則
- 創(chuàng)傷骨科患者術(shù)后疼痛影響因素評估及護(hù)理策略論文
評論
0/150
提交評論