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

📄 form0904.frm

📁 VB实验教程源码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "运动小球"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "结束"
      Height          =   375
      Left            =   360
      TabIndex        =   2
      Top             =   1440
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "开始"
      Height          =   375
      Left            =   360
      TabIndex        =   1
      Top             =   600
      Width           =   855
   End
   Begin VB.PictureBox Picture1 
      Height          =   2175
      Left            =   1680
      ScaleHeight     =   2115
      ScaleWidth      =   2595
      TabIndex        =   0
      Top             =   240
      Width           =   2655
      Begin VB.Shape Shape1 
         FillColor       =   &H0000FFFF&
         FillStyle       =   0  'Solid
         Height          =   615
         Left            =   840
         Shape           =   3  'Circle
         Top             =   1440
         Visible         =   0   'False
         Width           =   615
      End
   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 C1 As Integer
Private Sub Command1_Click()
'单击开始按钮
    Shape1.Visible = True
    Picture1.SetFocus
End Sub

Private Sub Command2_Click()
'单击结束按钮
    End
End Sub

Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer)
'在图片框中按键
    Select Case KeyCode
    Case 37 '按向左键
        Shape1.Move Shape1.Left - 100
    Case 39 '按向右键
        Shape1.Move Shape1.Left + 100
    Case 32 '按空格键
        If C1 = 0 Then
            Shape1.Move Shape1.Left, Shape1.Top - 1000
            C1 = 1
        Else
            Shape1.Move Shape1.Left, Shape1.Top + 1000
            C1 = 0
        End If
    End Select
End Sub

⌨️ 快捷键说明

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