新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
獲取系統(tǒng)的C#鼠標(biāo)指針相關(guān)代碼解析
C#鼠標(biāo)指針首先要從獲取鼠標(biāo)句柄開始,另外會(huì)制定例如懸停、點(diǎn)擊等等不同手勢的設(shè)定,以及不同樣式的設(shè)定。

系統(tǒng)設(shè)置了C#鼠標(biāo)指針的樣式 可以通過下面的方法設(shè)置程序的鼠標(biāo)指針樣式。
- view plaincopy to clipboardprint?
- [DllImport("user32.dll", EntryPoint = "SetCursor")]
- public static extern IntPtr SetCursor(IntPtr hCursor);
- ///
- /// 獲取鼠標(biāo)句柄
- ///
- /// IntPtr.Zero
- /// 樣式
- ///
- [DllImport("User32.dll", CharSet = CharSet.Auto)]
- public static extern IntPtr LoadCursor(IntPtr hInstance, CursorType cursor);
- public enum CursorType : uint
- {
- IDC_ARROW = 32512U,
- IDC_IBEAM = 32513U,
- IDC_WAIT = 32514U,
- IDC_CROSS = 32515U,
- IDC_UPARROW = 32516U,
- IDC_SIZE = 32640U,
- IDC_ICON = 32641U,
- IDC_SIZENWSE = 32642U,
- IDC_SIZENESW = 32643U,
- IDC_SIZEWE = 32644U,
- IDC_SIZENS = 32645U,
- IDC_SIZEALL = 32646U,
- IDC_NO = 32648U,
- IDC_HAND = 32649U,
- IDC_APPSTARTING = 32650U,
- IDC_HELP = 32651U
- }
- private void Form1_MouseMove(object sender, MouseEventArgs e)
- {
- IntPtr _HandCursorIntPrt = LoadCursor(IntPtr.Zero, CursorType.IDC_HAND);
- SetCursor(_HandCursorIntPrt);
- }
獲取系統(tǒng)的C#鼠標(biāo)指針相關(guān)代碼解析就介紹到這里。
【編輯推薦】
- C#線程同步詳細(xì)分析
- C#探討木馬程序淺談
- C# Pop3Connection類簡介
- C#數(shù)據(jù)類型簡單介紹
- C#計(jì)算素?cái)?shù)序列淺談
網(wǎng)頁標(biāo)題:獲取系統(tǒng)的C#鼠標(biāo)指針相關(guān)代碼解析
地址分享:http://fisionsoft.com.cn/article/djgghoo.html


咨詢
建站咨詢
