📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "用键盘控制动画"
ClientHeight = 3885
ClientLeft = 60
ClientTop = 345
ClientWidth = 6870
LinkTopic = "Form1"
ScaleHeight = 3885
ScaleWidth = 6870
StartUpPosition = 1 '所有者中心
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H00FFFF00&
BorderStyle = 1 'Fixed Single
ForeColor = &H80000008&
Height = 585
Left = 1125
TabIndex = 0
Top = 3225
Width = 4845
End
Begin VB.Image Image1
Height = 2055
Left = 2565
Picture = "Form1.frx":0000
Stretch = -1 'True
Top = 945
Width = 1575
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_Load()
Label1.Caption = "↑键图像向上移动并逐渐变小 ↓键图像向上移动并逐渐变大 →键图像向右移动并逐渐变小 ←键图像向左移动并逐渐变大 回车键还原"
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'按向左方向键,图像向左移动,尺寸逐渐增大
If KeyCode = 37 Then
Image1.Move Image1.Left - 100, Image1.Top, Image1.Width * 5 / 4, Image1.Height * 5 / 4
End If
'按向上方向键,图像向上移动,尺寸逐渐减小
If KeyCode = 38 Then
Image1.Move Image1.Left, Image1.Top - 100, Image1.Width * 4 / 5, Image1.Height * 4 / 5
End If
'按向右方向键,图像向右移动,尺寸逐渐减小
If KeyCode = 39 Then
Image1.Move Image1.Left + 100, Image1.Top, Image1.Width * 4 / 5, Image1.Height * 4 / 5
End If
'按向下方向键,图像向下移动,尺寸逐渐增大
If KeyCode = 40 Then
Image1.Move Image1.Left, Image1.Top + 100, Image1.Width * 5 / 4, Image1.Height * 5 / 4
End If
If KeyCode = vbKeyReturn Then
Image1.Left = 2565
Image1.Top = 945
Image1.Height = 2055
Image1.Width = 1575
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -