⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmtest.frm

📁 很好的教程原代码!
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmTest 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "cCursor Class Module Test"
   ClientHeight    =   3375
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5205
   ClipControls    =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   225
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   347
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdConfine 
      Caption         =   "     将鼠标限制在本按钮内       (再次单击按钮取消限制)"
      Height          =   1095
      Left            =   1800
      TabIndex        =   6
      Top             =   1080
      Width           =   3015
   End
   Begin VB.CommandButton cmdSnap 
      Caption         =   "鼠标跳至""触发鼠标的可见性""按钮"
      Height          =   615
      Left            =   1800
      TabIndex        =   5
      Top             =   120
      Width           =   3015
   End
   Begin VB.CommandButton cmdVisible 
      Caption         =   "触发鼠标的可见性"
      Height          =   495
      Left            =   1800
      TabIndex        =   4
      Top             =   2400
      Width           =   3015
   End
   Begin VB.TextBox txtY 
      Height          =   285
      Left            =   120
      TabIndex        =   2
      ToolTipText     =   "Changes the Y position of the Cursor"
      Top             =   1080
      Width           =   1095
   End
   Begin VB.TextBox txtX 
      Height          =   285
      Left            =   120
      TabIndex        =   0
      ToolTipText     =   "Changes the X position of the Cursor"
      Top             =   360
      Width           =   1095
   End
   Begin VB.Label lblCY 
      Caption         =   "Cursor Y:"
      Height          =   255
      Left            =   120
      TabIndex        =   3
      Top             =   840
      Width           =   1095
   End
   Begin VB.Label lblCX 
      Caption         =   "Cursor X:"
      Height          =   255
      Left            =   120
      TabIndex        =   1
      Top             =   120
      Width           =   1095
   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 Form_Click()
    Static Clipped As Boolean
    If Not Clipped Then
        Cursor.ClipTo Me
    Else
        Cursor.ClipTo Screen
    End If
    Clipped = Not Clipped
End Sub
'
Private Sub Form_Load()
    Set Cursor = New cCursor
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
txtX.Text = X
txtY.Text = Y
End Sub

'改变鼠标X值
Private Sub txtX_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        KeyAscii = 0
        Cursor.X = Val(txtX)
    End If
End Sub
'改变鼠标Y值
Private Sub txtY_KeyPress(KeyAscii As Integer)
     If KeyAscii = 13 Then
        KeyAscii = 0
        Cursor.Y = Val(txtY)
    End If
End Sub


⌨️ 快捷键说明

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