VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "在WinXP中飞行"
   ClientHeight    =   5205
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6885
   LinkTopic       =   "Form1"
   ScaleHeight     =   5205
   ScaleWidth      =   6885
   StartUpPosition =   3  '窗口缺省
   Begin VB.Image imgPlane 
      Height          =   735
      Left            =   5205
      Picture         =   "Form1.frx":0000
      Stretch         =   -1  'True
      Top             =   2370
      Width           =   840
   End
   Begin VB.Image imgBack 
      Height          =   9000
      Left            =   -6435
      Picture         =   "Form1.frx":030A
      Top             =   -4455
      Width           =   12000
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode                             '判断哪一个键被按下
        Case vbKeyLeft                              '如果向左键被按下
            If imgBack.Left <= 0 Then
                imgBack.Left = imgBack.Left + 50    '将背景图像控件向右移

            End If
        Case vbKeyRight
            If imgBack.Left > Form1.Width - imgBack.Width Then
                imgBack.Left = imgBack.Left - 50    '将背景图像控件向左移

            End If
       Case vbKeyUp
            If imgBack.Top < 0 Then
                imgBack.Top = imgBack.Top + 50      '将背景图像控件向下移

            End If
        Case vbKeyDown

              If imgBack.Top > Form1.Height - imgBack.Height Then
                imgBack.Top = imgBack.Top - 50      '将背景图像控件向上移

            End If
    End Select
End Sub

Private Sub Form_Load()
    '下面语句初始化背景图像的位置
    imgBack.Top = 0
    imgBack.Left = 0
    '下列语句初始化飞机的位置，使其位于窗体中央
    imgPlane.Top = (Form1.Height - imgPlane.Height) / 2
    imgPlane.Left = (Form1.Width - imgPlane.Width) / 2
End Sub


