home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 128 - Disc 1 / dpcs1098a.iso / Ocx / VCFIMP / VCIMPRES.Z / ROTATE.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-11-01  |  6.1 KB  |  194 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H00C0C0C0&
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "First Impression Rotation Demo"
  7.    ClientHeight    =   5820
  8.    ClientLeft      =   1185
  9.    ClientTop       =   1575
  10.    ClientWidth     =   8265
  11.    BeginProperty Font 
  12.       name            =   "MS Sans Serif"
  13.       charset         =   0
  14.       weight          =   700
  15.       size            =   8.25
  16.       underline       =   0   'False
  17.       italic          =   0   'False
  18.       strikethrough   =   0   'False
  19.    EndProperty
  20.    ForeColor       =   &H80000008&
  21.    Height          =   6285
  22.    Icon            =   "ROTATE.frx":0000
  23.    Left            =   1095
  24.    LinkTopic       =   "Form1"
  25.    MaxButton       =   0   'False
  26.    MinButton       =   0   'False
  27.    ScaleHeight     =   5820
  28.    ScaleWidth      =   8265
  29.    Top             =   1200
  30.    Width           =   8445
  31.    Begin VB.Frame Frame2 
  32.       Caption         =   " Options "
  33.       Height          =   1215
  34.       Left            =   5580
  35.       TabIndex        =   4
  36.       Top             =   3900
  37.       Width           =   2535
  38.       Begin VB.TextBox txtRotationDelta 
  39.          Height          =   285
  40.          Left            =   300
  41.          TabIndex        =   7
  42.          Text            =   "2"
  43.          Top             =   360
  44.          Width           =   375
  45.       End
  46.       Begin VB.CheckBox chkChangeElevation 
  47.          Caption         =   "Change Elevation"
  48.          Height          =   255
  49.          Left            =   480
  50.          TabIndex        =   5
  51.          Top             =   780
  52.          Value           =   1  'Checked
  53.          Width           =   1875
  54.       End
  55.       Begin VB.Label Label4 
  56.          Caption         =   "Rotation Delta"
  57.          Height          =   195
  58.          Left            =   780
  59.          TabIndex        =   6
  60.          Top             =   420
  61.          Width           =   1335
  62.       End
  63.    End
  64.    Begin VB.CommandButton cmdStart 
  65.       Appearance      =   0  'Flat
  66.       BackColor       =   &H80000005&
  67.       Caption         =   "Start Rotation"
  68.       Height          =   375
  69.       Left            =   5640
  70.       TabIndex        =   0
  71.       Top             =   5280
  72.       Width           =   2415
  73.    End
  74.    Begin VCIFiLib.VtChart VtChart1 
  75.       Height          =   5595
  76.       Left            =   120
  77.       TabIndex        =   3
  78.       Top             =   120
  79.       Width           =   5235
  80.       _version        =   65536
  81.       _extentx        =   9234
  82.       _extenty        =   9869
  83.       _stockprops     =   96
  84.       borderstyle     =   1
  85.       filename        =   "ROTATE.frx":030A
  86.    End
  87.    Begin VB.Label Label3 
  88.       Alignment       =   2  'Center
  89.       Caption         =   "Press Escape to stop."
  90.       BeginProperty Font 
  91.          name            =   "Arial"
  92.          charset         =   0
  93.          weight          =   700
  94.          size            =   9.75
  95.          underline       =   0   'False
  96.          italic          =   0   'False
  97.          strikethrough   =   0   'False
  98.       EndProperty
  99.       ForeColor       =   &H000000C0&
  100.       Height          =   255
  101.       Left            =   5580
  102.       TabIndex        =   2
  103.       Top             =   2820
  104.       Visible         =   0   'False
  105.       Width           =   2535
  106.    End
  107.    Begin VB.Label Label2 
  108.       Alignment       =   2  'Center
  109.       Caption         =   "First Impression Real-Time Rotation"
  110.       BeginProperty Font 
  111.          name            =   "Times New Roman"
  112.          charset         =   0
  113.          weight          =   700
  114.          size            =   24
  115.          underline       =   0   'False
  116.          italic          =   0   'False
  117.          strikethrough   =   0   'False
  118.       EndProperty
  119.       Height          =   2235
  120.       Left            =   5520
  121.       TabIndex        =   1
  122.       Top             =   120
  123.       Width           =   2655
  124.    End
  125. Attribute VB_Name = "Form1"
  126. Attribute VB_Creatable = False
  127. Attribute VB_Exposed = False
  128. Option Explicit
  129. Dim StillGoing%
  130. Private Sub chkChangeElevation_Click()
  131.    cmdStart.SetFocus
  132. End Sub
  133. Private Sub cmdStart_KeyDown(KeyCode As Integer, Shift As Integer)
  134.     If KeyCode = 27 Then
  135.         StillGoing = False
  136.     Else
  137.         KeyCode = 0
  138.     End If
  139. End Sub
  140. Private Sub cmdStart_Click()
  141.    Dim elevation!, rotation!, rot!, rotationDegrees!
  142.    Dim theView As Object
  143.    ' Put chart in Blit mode
  144.    VtChart1.DrawMode = VtChDrawModeBlit
  145.    ' Store a pointer to the view to minimize
  146.    ' traversing the object hierarchy
  147.    ' Get the rotation amount
  148.    rotationDegrees = Val(txtRotationDelta.Text)
  149.    If rotationDegrees < 1 Or rotationDegrees > 90 Then
  150.        MsgBox "Rotation must be between 1 and 90 degrees."
  151.        Exit Sub
  152.    End If
  153.    ' Keep going as long as this flag is True
  154.    StillGoing = True
  155.    Label3.Visible = True
  156.    cmdStart.SetFocus
  157.    ' Rotate the chart
  158.    rotation = 0
  159.    Do While StillGoing
  160.        If chkChangeElevation = 1 Then
  161.            rot = rotation Mod 180
  162.            elevation = IIf(rot <= 90, rot, 90 - (rot - 90))
  163.        Else
  164.            elevation = 30
  165.        End If
  166.        
  167.        VtChart1.Plot.View3d.Set rotation, elevation
  168.        
  169.        DoEvents ' Allow for the Escape key to get through
  170.        
  171.        ' Rotate through 360 degrees
  172.        rotation = rotation + rotationDegrees
  173.        If rotation >= 360 Then rotation = 0
  174.    Loop
  175.    Form1.Label3.Visible = False
  176. End Sub
  177. Private Sub Form_KeyPress(KeyAscii As Integer)
  178.     Dim RDegrees As Integer
  179.     If KeyAscii = 13 Then
  180.         RDegrees = Val(txtRotationDelta.Text)
  181.         If RDegrees < 1 Or RDegrees > 90 Then
  182.             MsgBox "Rotation must be between 1 and 90 degrees."
  183.         End If
  184.         KeyAscii = 0
  185.     End If
  186. End Sub
  187. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  188. End Sub
  189. Private Sub txtRotationDelta_KeyDown(KeyCode As Integer, Shift As Integer)
  190.    If StillGoing Then
  191.       cmdStart.SetFocus
  192.    End If
  193. End Sub
  194.