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

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