form1.frm

来自「VB源码,是初学者的福因.让你很快掌握VB编程」· FRM 代码 · 共 47 行

FRM
47
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2235
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   4425
   LinkTopic       =   "Form1"
   ScaleHeight     =   2235
   ScaleWidth      =   4425
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "走动"
      Height          =   375
      Left            =   360
      TabIndex        =   1
      Top             =   360
      Width           =   615
   End
   Begin VB.Label Label1 
      Caption         =   "请按←、→、↑和↓四个方向键让按钮走动"
      Height          =   255
      Left            =   480
      TabIndex        =   0
      Top             =   1800
      Width           =   3615
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
  Select Case KeyCode
         Case 37
              Command1.Left = Command1.Left - 50
         Case 38
              Command1.Top = Command1.Top - 50
         Case 39
              Command1.Left = Command1.Left + 50
         Case 40
              Command1.Top = Command1.Top + 50
End Select
End Sub

⌨️ 快捷键说明

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