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

📄 改变坐标移动控件.frm

📁 个人VB学习源码精选,自己学习时的一些编程小程序,希望对大家有帮助
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4815
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6255
   LinkTopic       =   "Form1"
   ScaleHeight     =   4815
   ScaleWidth      =   6255
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "Yes"
      Height          =   375
      Left            =   3240
      TabIndex        =   2
      Top             =   3480
      Width           =   1155
   End
   Begin VB.CommandButton Command1 
      Caption         =   "No"
      Height          =   375
      Left            =   1380
      TabIndex        =   1
      Top             =   3480
      Width           =   1155
   End
   Begin VB.Label Label1 
      Caption         =   "Do you love me?"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1620
      TabIndex        =   0
      Top             =   840
      Width           =   3015
   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 Type PointApi
    X As Long
    Y As Long
End Type

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim Lppoint As PointApi
    Dim r As Long
    
    r = GetCursorPos(Lppoint)
    If Command1.Left <> Screen.Width And Command1.Top <> Screen.Height Then
        Command1.Left = Lppoint.X + 1000 * (1 + Rnd)
        Command1.Top = Lppoint.Y + 500 * (1 + Rnd)
    End If
    If Command1.Left = Screen.Width Then
        Command1.Left = Lppoint.X - 1000 * Rnd - 500
    End If
    If Command1.Top = Screen.Height Then
        Command1.Top = Lppoint.Y - 500 * Rnd - 250
    End If
End Sub

Private Sub Command2_Click()
    End
End Sub

Private Sub Form_Click()
    Command1.Left = 1380
    Command1.Top = 3480
End Sub

Private Sub Form_Load()
    Randomize
End Sub

Private Sub Label1_Click()
    Form_Click
End Sub

⌨️ 快捷键说明

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