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 < prev    next >
Text File  |  1995-05-03  |  5KB  |  221 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. End
  108.  
  109. Sub Animate_Click ()
  110.     AnimateForm.Show
  111. End Sub
  112.  
  113. Sub Declination_Change ()
  114.     d = Val(Declination.Text)
  115.     Square.Declination = d / 57.29577951
  116.     Square.Draw
  117. End Sub
  118.  
  119. Sub DeclineSpin_SpinDown ()
  120.     d = Val(Declination.Text) - 1
  121.  
  122.     If (d < 0) Then
  123.         d = 0
  124.     End If
  125.  
  126.     Declination.Text = Str$(d)
  127. End Sub
  128.  
  129. Sub DeclineSpin_SpinUp ()
  130.     d = Val(Declination.Text) + 1
  131.  
  132.     If (d > 180) Then
  133.         d = 180
  134.     End If
  135.  
  136.     Declination.Text = Str$(d)
  137. End Sub
  138.  
  139. Sub Draw_Click ()
  140.     Square.Declination = Val(Declination.Text) / 57.29577951
  141.     Square.Theta = Val(Theta.Text) / 57.29577951
  142.     Square.Radius = Val(Radius.Text)
  143.     Square.Draw
  144. End Sub
  145.  
  146. Sub Form_Load ()
  147.     Set Square = CreateObject("SphereSquare.Object")
  148.     Declination.Text = Str$(Square.Declination)
  149.     Theta.Text = Str$(Square.Theta)
  150.     Radius.Text = Str$(Square.Radius)
  151.  
  152.     Square.BackColor = RGB(0, 0, 0)
  153.     Square.LineColorPositive = RGB(255, 255, 0)
  154.     Square.LineColorNegative = RGB(0, 255, 0)
  155.  
  156.     Square.SetWindowPosition 100, 100
  157.     Square.SetWindowSize 300, 300
  158.     Square.ShowWindow (SW_SHOW)
  159. End Sub
  160.  
  161. Sub Form_Unload (Cancel As Integer)
  162.     Set Square = Nothing
  163. End Sub
  164.  
  165. Sub Radius_Change ()
  166.     r = Val(Radius.Text)
  167.     Square.Radius = r
  168.     Square.Draw
  169. End Sub
  170.  
  171. Sub RadiusSpin_SpinDown ()
  172.     r = Val(Radius.Text) - 1
  173.  
  174.     If (r < 0) Then
  175.         r = 0
  176.     End If
  177.  
  178.     Radius.Text = Str$(r)
  179.     'Square.Radius = r
  180.     'Square.Draw
  181. End Sub
  182.  
  183. Sub RadiusSpin_SpinUp ()
  184.     r = Val(Radius.Text) + 1
  185.  
  186.     If (r > 500) Then
  187.         r = 500
  188.     End If
  189.  
  190.     Radius.Text = Str$(r)
  191.     'Square.Radius = r
  192.     'Square.Draw
  193. End Sub
  194.  
  195. Sub Theta_Change ()
  196.     th = Val(Theta.Text)
  197.     Square.Theta = th / 57.29577951
  198.     Square.Draw
  199. End Sub
  200.  
  201. Sub ThetaSpin_SpinDown ()
  202.     th = Val(Theta.Text) - 1
  203.  
  204.     If (th < 0) Then
  205.         th = 359
  206.     End If
  207.  
  208.     Theta.Text = Str$(th)
  209. End Sub
  210.  
  211. Sub ThetaSpin_SpinUp ()
  212.     th = Val(Theta.Text) + 1
  213.  
  214.     If (th > 359) Then
  215.         th = 0
  216.     End If
  217.  
  218.     Theta.Text = Str$(th)
  219. End Sub
  220.  
  221.