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

📄 form1.frm

📁 大量优秀的vb编程
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "鼠标位置跟踪"
   ClientHeight    =   3144
   ClientLeft      =   48
   ClientTop       =   348
   ClientWidth     =   3012
   LinkTopic       =   "Form1"
   ScaleHeight     =   3144
   ScaleWidth      =   3012
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "设置坐标"
      Height          =   372
      Left            =   960
      TabIndex        =   9
      Top             =   2160
      Width           =   852
   End
   Begin VB.TextBox Text2 
      Height          =   264
      Left            =   1680
      TabIndex        =   2
      Text            =   "Text1"
      Top             =   1800
      Width           =   972
   End
   Begin VB.TextBox Text1 
      Height          =   264
      Left            =   1680
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   1320
      Width           =   972
   End
   Begin VB.CommandButton Command1 
      Caption         =   "退出程序"
      Height          =   372
      Left            =   960
      TabIndex        =   0
      Top             =   2640
      Width           =   852
   End
   Begin VB.Label Label6 
      Caption         =   "鼠标的Y坐标:"
      Height          =   372
      Left            =   240
      TabIndex        =   8
      Top             =   1800
      Width           =   1212
   End
   Begin VB.Label Label5 
      Caption         =   "鼠标的X坐标:"
      Height          =   372
      Left            =   240
      TabIndex        =   7
      Top             =   1320
      Width           =   1212
   End
   Begin VB.Label Label4 
      Caption         =   "Label1"
      Height          =   372
      Left            =   1800
      TabIndex        =   6
      Top             =   720
      Width           =   732
   End
   Begin VB.Label Label3 
      Caption         =   "Label1"
      Height          =   372
      Left            =   1800
      TabIndex        =   5
      Top             =   240
      Width           =   732
   End
   Begin VB.Label Label2 
      Caption         =   "鼠标的Y坐标:"
      Height          =   372
      Left            =   240
      TabIndex        =   4
      Top             =   720
      Width           =   1212
   End
   Begin VB.Label Label1 
      Caption         =   "鼠标的X坐标:"
      Height          =   372
      Left            =   240
      TabIndex        =   3
      Top             =   240
      Width           =   1212
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Type POINTAPI
    x As Long
    y As Long
End Type

Private Sub Command1_Click()
    End
End Sub

Private Sub Command2_Click()
   
    If IsNumeric(Text1) And IsNumeric(Text2) Then
        i = SetCursorPos(Text1, Text2)
    End If
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim rc As Long
    Dim lpPoint As POINTAPI
    
    rc = GetCursorPos(lpPoint)
    
    Label3.Caption = lpPoint.x
    Label4.Caption = lpPoint.y

End Sub

⌨️ 快捷键说明

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