Access中如何设定鼠标指针?

Access中如何设定鼠标指针?

问题:

| 如何设定鼠标指针?

---|---

方法一:

| | Private __ Declare __ Function __ alxSetCursor __ Lib __ "user32" __ Alias __ "SetCursor" __ (ByVal __ hCursor __ As __ Long) __ As __ Long
'将指定的鼠标指针设为当前指针
Private __ Declare __ Function __ alxGetCursor __ Lib __ "user32" __ Alias __ "GetCursor" __ () __ As __ Long
'获取目前选择的鼠标指针的句柄

Private __ Sub __ MouseType()
'取得左右形光标的值
__ __ __ __ Screen.MousePointer __ = __ 9 __ '设屏幕鼠标为9(左右型鼠标)。
__ __ __ __ lngMouseOne __ = __ alxGetCursor() __ '返回左右型鼠标在WINDOWS(2000\98\XP)的值。
__ __ __ __ Screen.MousePointer __ = __ 7 __ '设屏幕鼠标为11(沙漏)。
__ __ __ __ lngMouseTwo __ = __ alxGetCursor() __ '返回左右型鼠标在WINDOWS(2000\98\XP)的值。
__ __ __ __ Screen.MousePointer __ = __ 0 __ '重设屏幕鼠标为0(ACCESS自确定)。
__ __ __ __ blTextout __ = __ False
__ __ __ __ blTextlook __ = __ False
End __ Sub

方法二:

|
随便找一个 __ .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"
__ __ __ __ '可随意调用其他的.cur鼠标样式文件,以达到显示各种指针的目的
__ __ __ __ lngMyCursor __ = __ LoadCursorFromFile(strCurFile)
__ __ __ __ lngSystemCursor __ = __ GetCursor()
__ __ __ __ lngSystemCursor __ = __ CopyCursor(lngSystemCursor)
__ __ __ __ SetSystemCursor __ lngMyCursor, __ OCR_NORMAL
__ __ __ __ Text1.SetFocus
__ __ __ __ Text1.Text __ = __ "鼠标指针已经设定为您要的状态"
__ __ __ __ cmdMyCursor.Enabled __ = __ False
__ __ __ __ cmdSystemCursor.Enabled __ = __ True
End __ Sub

Private __ Sub __ cmdSystemCursor_Click() __ '恢复系统指针样式
__ __ __ __ SetSystemCursor __ lngSystemCursor, __ OCR_NORMAL
__ __ __ __ Text1.SetFocus
__ __ __ __ Text1.Text __ = __ "鼠标指针已经恢复为系统状态"
__ __ __ __ 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


Published At
Categories with 数据库类
Tagged with
comments powered by Disqus