Access中如何設(shè)定鼠標(biāo)指針?

字號(hào):

方法一:
    Private Declare Function alxSetCursor Lib "user32" Alias "SetCursor" (ByVal hCursor As Long) As Long
    '將指定的鼠標(biāo)指針設(shè)為當(dāng)前指針
    Private Declare Function alxGetCursor Lib "user32" Alias "GetCursor" () As Long
    '獲取目前選擇的鼠標(biāo)指針的句柄
    Private Sub MouseType()
    '取得左右形光標(biāo)的值
     Screen.MousePointer = 9 '設(shè)屏幕鼠標(biāo)為9(左右型鼠標(biāo))。
     lngMouseOne = alxGetCursor() '返回左右型鼠標(biāo)在WINDOWS(2000\98\XP)的值。
     Screen.MousePointer = 7 '設(shè)屏幕鼠標(biāo)為11(沙漏)。
     lngMouseTwo = alxGetCursor() '返回左右型鼠標(biāo)在WINDOWS(2000\98\XP)的值。
     Screen.MousePointer = 0 '重設(shè)屏幕鼠標(biāo)為0(ACCESS自確定)。
     blTextout = False
     blTextlook = False
    End Sub
    方法二:
    隨便找一個(gè) .cur文件copy到mdb文件相同的目錄
    Private Declare Function CopyCursor Lib "user32" Alias "CopyIcon" (ByVal hcur As Long) As Long
    Private Declare Function LoadCursorFromFile Lib "user32" Alias "LoadCursorFromFileA" (ByVal lpstrCurFile As String) As Long
    Private Declare Function GetCursor Lib "user32" () As Long
    Private Declare Function SetSystemCursor Lib "user32" (ByVal hcur As Long, ByVal id As Long) As Long
    Private Const OCR_NORMAL = 32512
    dim lngMyCursor As Long
    Dim lngSystemCursor As Long
    Private Sub cmdMyCursor_Click() '更改指針樣式
     Dim strCurFile As String
     strCurFile = CurrentProject.Path + "\Cursor.cur"
     '可隨意調(diào)用其他的.cur鼠標(biāo)樣式文件,以達(dá)到顯示各種指針的目的
     lngMyCursor = LoadCursorFromFile(strCurFile)
     lngSystemCursor = GetCursor()
     lngSystemCursor = CopyCursor(lngSystemCursor)
     SetSystemCursor lngMyCursor, OCR_NORMAL
     Text1.SetFocus
     Text1.Text = "鼠標(biāo)指針已經(jīng)設(shè)定為您要的狀態(tài)"
     cmdMyCursor.Enabled = False
     cmdSystemCursor.Enabled = True
    End Sub
    private Sub cmdSystemCursor_Click() '恢復(fù)系統(tǒng)指針樣式
     SetSystemCursor lngSystemCursor, OCR_NORMAL
     Text1.SetFocus
     Text1.Text = "鼠標(biāo)指針已經(jīng)恢復(fù)為系統(tǒng)狀態(tài)"
     cmdMyCursor.Enabled = True
     cmdSystemCursor.Enabled = False
     lngSystemCursor = 0
    End Sub
    private Sub Form_Close()
     If lngSystemCursor <> 0 Then SetSystemCursor lngSystemCursor, OCR_NORMAL
    End Sub
    private Sub Form_Unload(Cancel As Integer)
     If lngSystemCursor <> 0 Then SetSystemCursor lngSystemCursor, OCR_NORMAL
    End Sub