home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / inole2 / chap15 / vbsquare / newvb / animate.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-05-03  |  4.3 KB  |  158 lines

  1. VERSION 4.00
  2. Begin VB.Form AnimateForm 
  3.    Caption         =   "Animate"
  4.    ClientHeight    =   1620
  5.    ClientLeft      =   7965
  6.    ClientTop       =   5175
  7.    ClientWidth     =   3735
  8.    BeginProperty Font 
  9.       name            =   "MS Sans Serif"
  10.       charset         =   1
  11.       weight          =   700
  12.       size            =   8.25
  13.       underline       =   0   'False
  14.       italic          =   0   'False
  15.       strikethrough   =   0   'False
  16.    EndProperty
  17.    Height          =   2025
  18.    Left            =   7905
  19.    LinkTopic       =   "Form1"
  20.    ScaleHeight     =   1620
  21.    ScaleWidth      =   3735
  22.    Top             =   4830
  23.    Width           =   3855
  24.    Begin VB.TextBox Theta 
  25.       Alignment       =   1  'Right Justify
  26.       Height          =   375
  27.       Left            =   2520
  28.       TabIndex        =   0
  29.       Text            =   "0"
  30.       Top             =   720
  31.       Width           =   735
  32.    End
  33.    Begin VB.Timer Animate 
  34.       Interval        =   1
  35.       Left            =   1380
  36.       Top             =   1140
  37.    End
  38.    Begin VB.CommandButton Stop 
  39.       Caption         =   "S&top"
  40.       Default         =   -1  'True
  41.       Height          =   495
  42.       Left            =   120
  43.       TabIndex        =   2
  44.       Top             =   840
  45.       Width           =   1095
  46.    End
  47.    Begin VB.CommandButton Start 
  48.       Caption         =   "&Start"
  49.       Height          =   495
  50.       Left            =   120
  51.       TabIndex        =   3
  52.       Top             =   240
  53.       Width           =   1095
  54.    End
  55.    Begin VB.TextBox Declination 
  56.       Alignment       =   1  'Right Justify
  57.       Height          =   375
  58.       Left            =   2520
  59.       TabIndex        =   1
  60.       Text            =   "0"
  61.       Top             =   240
  62.       Width           =   735
  63.    End
  64.    Begin Spin.SpinButton ThetaSpin 
  65.       Height          =   375
  66.       Left            =   3240
  67.       TabIndex        =   7
  68.       Top             =   720
  69.       Width           =   255
  70.       _version        =   65536
  71.       _extentx        =   450
  72.       _extenty        =   661
  73.       _stockprops     =   73
  74.       delay           =   100
  75.    End
  76.    Begin Spin.SpinButton DeclineSpin 
  77.       Height          =   375
  78.       Left            =   3240
  79.       TabIndex        =   6
  80.       Top             =   240
  81.       Width           =   255
  82.       _version        =   65536
  83.       _extentx        =   450
  84.       _extenty        =   661
  85.       _stockprops     =   73
  86.       delay           =   100
  87.    End
  88.    Begin VB.Label DText 
  89.       Alignment       =   1  'Right Justify
  90.       Caption         =   "&Declination"
  91.       Height          =   255
  92.       Left            =   1440
  93.       TabIndex        =   5
  94.       Top             =   300
  95.       Width           =   975
  96.    End
  97.    Begin VB.Label TText 
  98.       Alignment       =   1  'Right Justify
  99.       Caption         =   "&Theta"
  100.       Height          =   255
  101.       Left            =   1440
  102.       TabIndex        =   4
  103.       Top             =   780
  104.       Width           =   975
  105.    End
  106. Attribute VB_Name = "AnimateForm"
  107. Attribute VB_Creatable = False
  108. Attribute VB_Exposed = False
  109. Dim fStart As Integer
  110. Private Sub Animate_Timer()
  111.     If fStart Then
  112.         Square.Declination = Square.Declination + (Val(Declination.Text) / 57.29577951)
  113.         Square.Theta = Square.Theta + (Val(Theta.Text) / 57.29577951)
  114.         Square.Draw
  115.     End If
  116. End Sub
  117. Private Sub DeclineSpin_SpinDown()
  118.     d = Val(Declination.Text) - 1
  119.     If (d < 0) Then
  120.         d = 45
  121.     End If
  122.     Declination.Text = Str$(d)
  123. End Sub
  124. Private Sub DeclineSpin_SpinUp()
  125.     d = Val(Declination.Text) + 1
  126.     If (d > 45) Then
  127.         d = 0
  128.     End If
  129.     Declination.Text = Str$(d)
  130. End Sub
  131. Private Sub DeclineSpin_Click()
  132. End Sub
  133. Private Sub Form_Load()
  134.     fStart = False
  135.     Declination.Text = "0"
  136.     Theta.Text = "0"
  137. End Sub
  138. Private Sub Start_Click()
  139.     fStart = True
  140. End Sub
  141. Private Sub Stop_Click()
  142.     fStart = False
  143. End Sub
  144. Private Sub ThetaSpin_SpinDown()
  145.     th = Val(Theta.Text) - 1
  146.     If (th < 0) Then
  147.         th = 45
  148.     End If
  149.     Theta.Text = Str$(th)
  150. End Sub
  151. Private Sub ThetaSpin_SpinUp()
  152.     th = Val(Theta.Text) + 1
  153.     If (th > 45) Then
  154.         th = 0
  155.     End If
  156.     Theta.Text = Str$(th)
  157. End Sub
  158.