📄 frmtest.frm
字号:
VERSION 5.00
Begin VB.Form frmTest
BorderStyle = 3 'Fixed Dialog
Caption = "鼠标控制"
ClientHeight = 3165
ClientLeft = 45
ClientTop = 330
ClientWidth = 4290
ClipControls = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 211
ScaleMode = 3 'Pixel
ScaleWidth = 286
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "退出程序"
Height = 492
Left = 480
TabIndex = 4
Top = 2400
Width = 3012
End
Begin VB.CommandButton cmdConfine
Caption = "限定光标在这个按钮内移动(再次单击按钮将取消限制)"
Height = 492
Left = 480
TabIndex = 2
Top = 1200
Width = 3015
End
Begin VB.CommandButton cmdSnap
Caption = "移动光标到“设置鼠标消失”按钮"
Height = 492
Left = 480
TabIndex = 1
Top = 600
Width = 3012
End
Begin VB.CommandButton cmdVisible
Caption = "设置鼠标消失"
Height = 492
Left = 480
TabIndex = 0
Top = 1800
Width = 3012
End
Begin VB.Label Label1
Caption = "在窗体内单击鼠标将限制光标在窗体内移动!"
Height = 252
Left = 360
TabIndex = 3
Top = 120
Width = 4212
End
End
Attribute VB_Name = "frmTest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
DefLng A-Z
Dim Cursor As cCursor
Private Sub cmdConfine_Click()
Static Confined As Boolean
If Not Confined Then
Cursor.ClipTo cmdConfine
Confined = True
Else
Cursor.ClipTo Screen
Confined = False
End If
End Sub
Private Sub cmdSnap_Click()
Cursor.SnapTo cmdVisible
End Sub
Private Sub cmdVisible_Click()
Cursor.Visible = Not Cursor.Visible
End Sub
Private Sub Command1_Click()
End
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Click()
Static Clipped As Boolean
If Not Clipped Then
Cursor.ClipTo Me
Label1.Caption = "在窗体内单击鼠标将释放光标!"
Else
Cursor.ClipTo Screen
Label1.Caption = "在窗体内单击鼠标将限制光标在窗体内移动!"
End If
Clipped = Not Clipped
End Sub
Private Sub Form_Load()
Set Cursor = New cCursor
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -