VB程序移动放大图片

来源:百度知道 编辑:UC知道 时间:2024/07/04 06:22:28
一个窗体,一个图片框或者一个图像框,装入一张图片,让这个框从左移动到右面,移动的同时,框也从小变大,里面的图片也跟着变大,代码怎样写?

Dim px, py

Private Sub Form_Activate()
Timer1.Enabled = True
Timer1.Interval = 100
px = Image1.Width
py = Image1.Height
Image1.Left = -px
Image1.Stretch = True
Image1.Picture = LoadPicture("E:\图片\001.JPG")
End Sub

Private Sub Timer1_Timer()
Image1.Left = Image1.Left + 100
Image1.Width = Image1.Width + 30
Image1.Height = Image1.Height + 30
If Image1.Left > Me.ScaleWidth Then
Image1.Left = -px
Image1.Width = px
Image1.Height = py
End If

End Sub