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 / square.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-03  |  5.1 KB  |  192 lines

  1. VERSION 2.00
  2. Begin Form RotateControl 
  3.    Caption         =   "Rotation Controller"
  4.    ClientHeight    =   1695
  5.    ClientLeft      =   7920
  6.    ClientTop       =   3030
  7.    ClientWidth     =   3795
  8.    Height          =   2070
  9.    Left            =   7875
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   1695
  12.    ScaleWidth      =   3795
  13.    Top             =   2700
  14.    Width           =   3885
  15.    Begin CommandButton Animate 
  16.       Caption         =   "&Animate..."
  17.       Height          =   495
  18.       Left            =   240
  19.       TabIndex        =   4
  20.       Top             =   960
  21.       Width           =   1095
  22.    End
  23.    Begin TextBox Radius 
  24.       Alignment       =   1  'Right Justify
  25.       Height          =   375
  26.       Left            =   2640
  27.       TabIndex        =   2
  28.       Text            =   "100"
  29.       Top             =   1140
  30.       Width           =   735
  31.    End
  32.    Begin SpinButton RadiusSpin 
  33.       Delay           =   0
  34.       Height          =   375
  35.       Left            =   3360
  36.       Top             =   1140
  37.       Width           =   255
  38.    End
  39.    Begin TextBox Theta 
  40.       Alignment       =   1  'Right Justify
  41.       Height          =   375
  42.       Left            =   2640
  43.       TabIndex        =   3
  44.       Text            =   "0"
  45.       Top             =   600
  46.       Width           =   735
  47.    End
  48.    Begin SpinButton ThetaSpin 
  49.       Delay           =   0
  50.       Height          =   375
  51.       Left            =   3360
  52.       Top             =   600
  53.       Width           =   255
  54.    End
  55.    Begin TextBox Declination 
  56.       Alignment       =   1  'Right Justify
  57.       Height          =   375
  58.       Left            =   2640
  59.       TabIndex        =   1
  60.       Text            =   "0"
  61.       Top             =   120
  62.       Width           =   735
  63.    End
  64.    Begin SpinButton DeclineSpin 
  65.       Delay           =   0
  66.       Height          =   375
  67.       Left            =   3360
  68.       Top             =   120
  69.       Width           =   255
  70.    End
  71.    Begin CommandButton Draw 
  72.       Caption         =   "&Draw"
  73.       Default         =   -1  'True
  74.       Height          =   495
  75.       Left            =   240
  76.       TabIndex        =   0
  77.       Top             =   240
  78.       Width           =   1095
  79.    End
  80.    Begin Label RadiusText 
  81.       Alignment       =   1  'Right Justify
  82.       Caption         =   "&Radius"
  83.       Height          =   255
  84.       Left            =   1440
  85.       TabIndex        =   7
  86.       Top             =   1200
  87.       Width           =   1095
  88.    End
  89.    Begin Label TText 
  90.       Alignment       =   1  'Right Justify
  91.       Caption         =   "&Theta"
  92.       Height          =   255
  93.       Left            =   1440
  94.       TabIndex        =   6
  95.       Top             =   660
  96.       Width           =   1095
  97.    End
  98.    Begin Label DText 
  99.       Alignment       =   2  'Center
  100.       Caption         =   "&Declination"
  101.       Height          =   255
  102.       Left            =   1440
  103.       TabIndex        =   5
  104.       Top             =   180
  105.       Width           =   1155
  106.    End
  107. Sub Animate_Click ()
  108.     AnimateForm.Show
  109. End Sub
  110. Sub Declination_Change ()
  111.     d = Val(Declination.Text)
  112.     Square.Declination = d / 57.29577951
  113.     Square.Draw
  114. End Sub
  115. Sub DeclineSpin_SpinDown ()
  116.     d = Val(Declination.Text) - 1
  117.     If (d < 0) Then
  118.         d = 0
  119.     End If
  120.     Declination.Text = Str$(d)
  121. End Sub
  122. Sub DeclineSpin_SpinUp ()
  123.     d = Val(Declination.Text) + 1
  124.     If (d > 180) Then
  125.         d = 180
  126.     End If
  127.     Declination.Text = Str$(d)
  128. End Sub
  129. Sub Draw_Click ()
  130.     Square.Declination = Val(Declination.Text) / 57.29577951
  131.     Square.Theta = Val(Theta.Text) / 57.29577951
  132.     Square.Radius = Val(Radius.Text)
  133.     Square.Draw
  134. End Sub
  135. Sub Form_Load ()
  136.     Set Square = CreateObject("SphereSquare.Object")
  137.     Declination.Text = Str$(Square.Declination)
  138.     Theta.Text = Str$(Square.Theta)
  139.     Radius.Text = Str$(Square.Radius)
  140.     Square.BackColor = RGB(0, 0, 0)
  141.     Square.LineColorPositive = RGB(255, 255, 0)
  142.     Square.LineColorNegative = RGB(0, 255, 0)
  143.     Square.SetWindowPosition 100, 100
  144.     Square.SetWindowSize 300, 300
  145.     Square.ShowWindow (SW_SHOW)
  146. End Sub
  147. Sub Form_Unload (Cancel As Integer)
  148.     Set Square = Nothing
  149. End Sub
  150. Sub Radius_Change ()
  151.     r = Val(Radius.Text)
  152.     Square.Radius = r
  153.     Square.Draw
  154. End Sub
  155. Sub RadiusSpin_SpinDown ()
  156.     r = Val(Radius.Text) - 1
  157.     If (r < 0) Then
  158.         r = 0
  159.     End If
  160.     Radius.Text = Str$(r)
  161.     'Square.Radius = r
  162.     'Square.Draw
  163. End Sub
  164. Sub RadiusSpin_SpinUp ()
  165.     r = Val(Radius.Text) + 1
  166.     If (r > 500) Then
  167.         r = 500
  168.     End If
  169.     Radius.Text = Str$(r)
  170.     'Square.Radius = r
  171.     'Square.Draw
  172. End Sub
  173. Sub Theta_Change ()
  174.     th = Val(Theta.Text)
  175.     Square.Theta = th / 57.29577951
  176.     Square.Draw
  177. End Sub
  178. Sub ThetaSpin_SpinDown ()
  179.     th = Val(Theta.Text) - 1
  180.     If (th < 0) Then
  181.         th = 359
  182.     End If
  183.     Theta.Text = Str$(th)
  184. End Sub
  185. Sub ThetaSpin_SpinUp ()
  186.     th = Val(Theta.Text) + 1
  187.     If (th > 359) Then
  188.         th = 0
  189.     End If
  190.     Theta.Text = Str$(th)
  191. End Sub
  192.