Description: Simple animation with picure control only & bunch of image files too)
Minimum requirements: VB6
Download: source code
Screenshot:
Project: EXE
Controls: cmdDirection (Command Button, Caption = "go back"), tmr (Timer, Interval = 20), pic (PictureBox, AutoSize = -1 'True, BorderStyle = 0 'None)
Additional references: none
Code:
Option Explicit
Dim i As Integer
Dim j As Integer
Private Sub cmdDirection_Click()
If cmdDirection.Caption = "go back" Then
cmdDirection.Caption = "go"
j = -60
Else
cmdDirection.Caption = "go back"
j = 60
End If
End Sub
Private Sub Form_Load()
Set pic.Picture = LoadPicture("untitled1.bmp")
i = 1
j = 60
End Sub
Private Sub tmr_Timer()
If i < 8 Then i = i + 1 Else i = 1
If (pic.Left < Me.Width And j > 0) Or (pic.Left > 0 And j < 0) Then
pic.Left = pic.Left + j
Set pic.Picture = LoadPicture("untitled" & i & ".bmp")
End If
End Sub
No comments:
Post a Comment