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

📄 form1.frm

📁 关于鼠标的VB程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   5100
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7830
   LinkTopic       =   "Form1"
   ScaleHeight     =   340
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   522
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command3 
      Caption         =   "VBDraw"
      Height          =   375
      Left            =   4140
      TabIndex        =   6
      Top             =   120
      Width           =   1245
   End
   Begin VB.CommandButton Command2 
      Caption         =   "API Draw"
      Height          =   375
      Left            =   5490
      TabIndex        =   5
      Top             =   120
      Width           =   1245
   End
   Begin VB.CommandButton Command1 
      Caption         =   "coordination"
      Height          =   375
      Left            =   2790
      TabIndex        =   4
      Top             =   120
      Width           =   1245
   End
   Begin VB.TextBox txtY 
      Height          =   315
      Left            =   1740
      TabIndex        =   1
      Text            =   "Text2"
      Top             =   150
      Width           =   795
   End
   Begin VB.TextBox txtX 
      Height          =   285
      Left            =   450
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   180
      Width           =   795
   End
   Begin VB.Label Label2 
      Caption         =   "Y:"
      Height          =   285
      Left            =   1440
      TabIndex        =   3
      Top             =   210
      Width           =   555
   End
   Begin VB.Label Label1 
      Caption         =   "X:"
      Height          =   315
      Left            =   120
      TabIndex        =   2
      Top             =   180
      Width           =   495
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim isInDraw As Boolean
Dim nPreX As Integer
Dim nPreY As Integer

Private Sub Command1_Click()
    With Form1
        .ScaleLeft = -200
        .ScaleTop = 250
        .ScaleHeight = -400
        .ScaleWidth = 500
    End With
    
    Line (-200, 0)-(300, 0)
    Line (0, 250)-(0, -150)
    CurrentX = 0
    CurrentY = 0
    Print 0
    
    Command1.Move 0, 0
    
End Sub

Private Sub Command2_Click()
    Dim i As Long
    For i = 0 To 30000
        LineTo hdc, 100, 100
    Next i
    MsgBox "done"
End Sub

Private Sub Command3_Click()
    Dim i As Long
    For i = 0 To 30000
        Line (0, 0)-(100, 100)
    Next i
    MsgBox "done"
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    isInDraw = True
    MousePointer = vbCrosshair
    nPreX = x
    nPreY = y
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    If isInDraw Then
        Line (nPreX, nPreY)-(x, y)
        nPreX = x
        nPreY = y
    End If
    
    txtX = x
    txtY = y
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    isInDraw = False
    MousePointer = vbDefault
End Sub


⌨️ 快捷键说明

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