WEB开发网
开发学院数据库Access Access API使用集锦 阅读

Access API使用集锦

 2005-10-31 12:35:48 来源:WEB开发网   
核心提示: 1.把以下代码添加如模块:Option Explicit Type RECTLeft As LongTop As LongRight As LongBottom As LongEnd Type Declare Function ClipCursor Lib "user32" _(lpRect As

  1.把以下代码添加如模块:

Option Explicit

Type RECT

Left As Long

Top As Long

Right As Long

Bottom As Long

End Type

Declare Function ClipCursor Lib "user32" _(lpRect As Any) As Long

Public Sub DisableTrap(CurForm As Form)

Dim erg As Long

'声明过程变量

'设置新坐标

Dim NewRect As RECT

CurForm.Caption = "释放鼠标"

With NewRect

.Left = 0&

.Top = 0&

.Right = Screen.Width / Screen.TwipsPerPixelX

.Bottom = Screen.Height / Screen.TwipsPerPixelY

End With

erg& = ClipCursor(NewRect)

End Sub

Public Sub EnableTrap(CurForm As Form)

Dim x As Long, y As Long, erg As Long

'声明过程变量

'设置新坐标

Dim NewRect As RECT

'得到TwipsperPixel

'窗体的ScaleMode必须设为Twips!!!

x& = Screen.TwipsPerPixelX

y& = Screen.TwipsPerPixelY

CurForm.Caption = "捕捉鼠标"

'设置光标的范围

With NewRect

.Left = CurForm.Left / x&

.Top = CurForm.Top / y&

.Right = .Left + CurForm.Width / x&

.Bottom = .Top + CurForm.Height / y&

End With

erg& = ClipCursor(NewRect)

End Sub



  2.在窗体上添加两个命令按钮(Command Button)。

上一页  1 2 3 4 5 6  下一页

Tags:Access API 使用

编辑录入:coldstar [复制链接] [打 印]
赞助商链接