form1.frm

来自「本文件包含200个visual baisc实例」· FRM 代码 · 共 73 行

FRM
73
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "限制鼠标移动区域"
   ClientHeight    =   1965
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5415
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   1965
   ScaleWidth      =   5415
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command3 
      Caption         =   "退出"
      Height          =   450
      Left            =   1605
      TabIndex        =   2
      Top             =   1380
      Width           =   2205
   End
   Begin VB.CommandButton Command2 
      Caption         =   "解除"
      Height          =   450
      Left            =   1605
      TabIndex        =   1
      Top             =   750
      Width           =   2205
   End
   Begin VB.CommandButton Command1 
      Caption         =   "限制鼠标"
      Height          =   450
      Left            =   1605
      TabIndex        =   0
      Top             =   135
      Width           =   2205
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long

Private Type RECT    '用户自定义类型
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type
Dim mouse As RECT
Private Sub Command1_Click()
  mouse.Left = Me.Left / Screen.TwipsPerPixelX
  mouse.Top = Me.Top / Screen.TwipsPerPixelY
  mouse.Right = (Me.Left + Me.Width) / Screen.TwipsPerPixelX
  mouse.Bottom = (Me.Top + Me.Height) / Screen.TwipsPerPixelY
  ClipCursor mouse
End Sub
Private Sub Command2_Click()
  mouse.Left = 0
  mouse.Top = 0
  mouse.Right = (Screen.Width) / Screen.TwipsPerPixelX
  mouse.Bottom = (Screen.Height) / Screen.TwipsPerPixelY
  ClipCursor mouse
End Sub

Private Sub Command3_Click()
  End
End Sub


⌨️ 快捷键说明

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