📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3150
ClientLeft = 60
ClientTop = 390
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3150
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 150
Left = 480
Top = 1560
End
Begin VB.Image Image1
Height = 2640
Left = 1320
Picture = "Form1.frx":0000
Stretch = -1 'True
Top = 240
Width = 2625
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim IsPlaying As Boolean '动画是否启动
Dim Width0%, Height0% '气球原大小
Dim DetaX%, DetaY% '沿X、Y轴的缩放增量
Private Sub Form_Load()
IsPlaying = False
Image1.ToolTipText = "开始"
Width0% = Image1.Width '保存气球的初始大小
Height0% = Image1.Height
DetaX% = 100
DetaY% = 100
End Sub
Private Sub Image1_Click()
If IsPlaying Then
IsPlaying = False
Timer1.Enabled = IsPlaying
Image1.ToolTipText = "开始"
Else
IsPlaying = True
Timer1.Enabled = IsPlaying
Image1.ToolTipText = "停止"
End If
End Sub
Private Sub Timer1_Timer()
'移动Image对象,保持同心缩放
Image1.Move Image1.Left - DetaX% / 2, Image1.Top - DetaY% / 2
'按增量缩放
Image1.Width = Image1.Width + DetaX%
Image1.Height = Image1.Height + DetaY%
'碰到边界,则缩小
If Image1.Left + Image1.Width >= Form1.Width Or _
Image1.Top + Image1.Height >= Form1.Height Or _
Image1.Left <= 0 Or Image1.Top <= 0 Then
DetaX% = -DetaX%
DetaY% = -DetaY%
End If
'缩到原大,则膨胀
If Image1.Width <= Width0% Or Image1.Height <= Height0% Then
DetaX% = -DetaX%
DetaY% = -DetaY%
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -