home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / graphics / stickman.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-05-16  |  4.4 KB  |  147 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "StickMan Animation Demonstration"
  4.    ClientHeight    =   1245
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1770
  7.    ClientWidth     =   7425
  8.    Height          =   1935
  9.    Icon            =   STICKMAN.FRX:0000
  10.    Left            =   1035
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   1245
  14.    ScaleWidth      =   7425
  15.    Top             =   1140
  16.    Width           =   7545
  17.    Begin Timer Timer1 
  18.       Enabled         =   0   'False
  19.       Interval        =   50
  20.       Left            =   3450
  21.       Top             =   345
  22.    End
  23.    Begin PictureBox Picture3 
  24.       AutoSize        =   -1  'True
  25.       BorderStyle     =   0  'None
  26.       Height          =   480
  27.       Left            =   2310
  28.       Picture         =   STICKMAN.FRX:0302
  29.       ScaleHeight     =   480
  30.       ScaleWidth      =   480
  31.       TabIndex        =   2
  32.       Top             =   735
  33.       Visible         =   0   'False
  34.       Width           =   480
  35.    End
  36.    Begin PictureBox Picture1 
  37.       AutoSize        =   -1  'True
  38.       BorderStyle     =   0  'None
  39.       Height          =   480
  40.       Left            =   0
  41.       Picture         =   STICKMAN.FRX:0604
  42.       ScaleHeight     =   480
  43.       ScaleWidth      =   480
  44.       TabIndex        =   0
  45.       Top             =   780
  46.       Visible         =   0   'False
  47.       Width           =   480
  48.    End
  49.    Begin PictureBox Picture2 
  50.       AutoSize        =   -1  'True
  51.       BorderStyle     =   0  'None
  52.       Height          =   480
  53.       Left            =   1005
  54.       Picture         =   STICKMAN.FRX:0906
  55.       ScaleHeight     =   480
  56.       ScaleWidth      =   480
  57.       TabIndex        =   1
  58.       Top             =   765
  59.       Visible         =   0   'False
  60.       Width           =   480
  61.    End
  62.    Begin Menu FileMenu 
  63.       Caption         =   "&File"
  64.       Begin Menu FileWalk 
  65.          Caption         =   "&Walk"
  66.          Index           =   0
  67.          Visible         =   0   'False
  68.       End
  69.       Begin Menu FileReset 
  70.          Caption         =   "&Reset"
  71.       End
  72.       Begin Menu FileSep 
  73.       End
  74.       Begin Menu FileExit 
  75.          Caption         =   "E&xit"
  76.       End
  77.    End
  78. Option Explicit
  79. Dim num As Integer
  80. Sub FileExit_Click ()
  81.     End
  82. End Sub
  83. Sub FileReset_Click ()
  84.     ' Make sure all our pictures start at the left and
  85.     ' make the first one visible...
  86.     ' Also, enable the "walk" menu item
  87.     picture1.Left = 0
  88.     picture2.Left = 0
  89.     picture3.Left = 0
  90.     picture1.Top = 750
  91.     picture2.Top = 750
  92.     picture3.Top = 750
  93.     picture1.Visible = True
  94.     picture2.Visible = False
  95.     picture3.Visible = False
  96.     FileWalk(0).Caption = "&Walk"
  97.     FileWalk(0).Visible = True
  98.     FileWalk(0).Enabled = True
  99.     num = 1
  100. End Sub
  101. Sub FileWalk_Click (index As Integer)
  102.     If FileWalk(0).Caption = "&Walk" Then
  103.         ' Time to start walking.
  104.         timer1.Enabled = True
  105.         FileWalk(0).Caption = "&Stop"
  106.     Else
  107.         ' Time to stop walking.
  108.         timer1.Enabled = False
  109.         FileWalk(0).Caption = "&Walk"
  110.     End If
  111. End Sub
  112. Sub Form_Load ()
  113.     FileReset_Click
  114. End Sub
  115. Sub Timer1_Timer ()
  116.     Const INCREMENT = 100
  117.     ' First, see which picture is currently visible...
  118.     Select Case num
  119.           Case 1
  120.             ' Move the next picture over, turn us off, and
  121.             ' turn the next picture on...
  122.             picture1.Left = picture1.Left + INCREMENT
  123.             picture3.Visible = False
  124.             picture1.Visible = True
  125.           Case 2
  126.             ' Move the next picture over, turn us off, and
  127.             ' turn the next picture on...
  128.             picture2.Left = picture1.Left + INCREMENT
  129.             picture1.Visible = False
  130.             picture2.Visible = True
  131.           Case 3
  132.             ' Move the next picture over, turn us off, and
  133.             ' turn the next picture on...
  134.             picture3.Left = picture1.Left + INCREMENT
  135.             picture2.Visible = False
  136.             picture3.Visible = True
  137.     End Select
  138.     ' Now, make sure we keep track of which picture is visible
  139.     num = num + 1
  140.     If num > 3 Then num = 1
  141.     ' Check to see if we are off the edge of the form.
  142.     If picture1.Left > Form1.ScaleWidth Then
  143.         FileWalk_Click (0) ' Pretend like the user pulled "stop"
  144.         FileWalk(0).Enabled = False ' Disable the Walk option until reset
  145.     End If
  146. End Sub
  147.