module1.bas

来自「我用VB做的一个校园导游系统!界面友好」· BAS 代码 · 共 48 行

BAS
48
字号
Attribute VB_Name = "Module1"
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
    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
    x& = Screen.TwipsPerPixelX
    y& = Screen.TwipsPerPixelY
    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


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?