home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH5 / SRC / ICOANIM.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-05-02  |  7.7 KB  |  269 lines

  1. VERSION 4.00
  2. Begin VB.Form IconAnimationForm 
  3.    Caption         =   "IconAnimation"
  4.    ClientHeight    =   1140
  5.    ClientLeft      =   2925
  6.    ClientTop       =   2160
  7.    ClientWidth     =   2490
  8.    Height          =   1830
  9.    Left            =   2865
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   1140
  12.    ScaleWidth      =   2490
  13.    Top             =   1530
  14.    Width           =   2610
  15.    Begin VB.OptionButton Choice 
  16.       Caption         =   "Signal"
  17.       Height          =   255
  18.       Index           =   2
  19.       Left            =   840
  20.       TabIndex        =   2
  21.       Top             =   840
  22.       Width           =   855
  23.    End
  24.    Begin VB.OptionButton Choice 
  25.       Caption         =   "Flame"
  26.       Height          =   255
  27.       Index           =   1
  28.       Left            =   840
  29.       TabIndex        =   1
  30.       Top             =   480
  31.       Width           =   855
  32.    End
  33.    Begin VB.OptionButton Choice 
  34.       Caption         =   "Circle"
  35.       Height          =   255
  36.       Index           =   0
  37.       Left            =   840
  38.       TabIndex        =   0
  39.       Top             =   120
  40.       Value           =   -1  'True
  41.       Width           =   855
  42.    End
  43.    Begin VB.Timer Timer1 
  44.       Interval        =   100
  45.       Left            =   4920
  46.       Top             =   1560
  47.    End
  48.    Begin VB.Image Flame 
  49.       Height          =   480
  50.       Index           =   5
  51.       Left            =   3480
  52.       Picture         =   "ICOANIM.frx":0000
  53.       Top             =   1560
  54.       Visible         =   0   'False
  55.       Width           =   480
  56.    End
  57.    Begin VB.Image Flame 
  58.       Height          =   480
  59.       Index           =   6
  60.       Left            =   3960
  61.       Picture         =   "ICOANIM.frx":030A
  62.       Top             =   1560
  63.       Visible         =   0   'False
  64.       Width           =   480
  65.    End
  66.    Begin VB.Image Flame 
  67.       Height          =   480
  68.       Index           =   7
  69.       Left            =   4440
  70.       Picture         =   "ICOANIM.frx":0614
  71.       Top             =   1560
  72.       Visible         =   0   'False
  73.       Width           =   480
  74.    End
  75.    Begin VB.Image Flame 
  76.       Height          =   480
  77.       Index           =   4
  78.       Left            =   3000
  79.       Picture         =   "ICOANIM.frx":091E
  80.       Top             =   1560
  81.       Visible         =   0   'False
  82.       Width           =   480
  83.    End
  84.    Begin VB.Image Flame 
  85.       Height          =   480
  86.       Index           =   3
  87.       Left            =   4440
  88.       Picture         =   "ICOANIM.frx":0C28
  89.       Top             =   960
  90.       Visible         =   0   'False
  91.       Width           =   480
  92.    End
  93.    Begin VB.Image Flame 
  94.       Height          =   480
  95.       Index           =   2
  96.       Left            =   3960
  97.       Picture         =   "ICOANIM.frx":0F32
  98.       Top             =   960
  99.       Visible         =   0   'False
  100.       Width           =   480
  101.    End
  102.    Begin VB.Image Flame 
  103.       Height          =   480
  104.       Index           =   1
  105.       Left            =   3480
  106.       Picture         =   "ICOANIM.frx":123C
  107.       Top             =   960
  108.       Visible         =   0   'False
  109.       Width           =   480
  110.    End
  111.    Begin VB.Image Flame 
  112.       Height          =   480
  113.       Index           =   0
  114.       Left            =   3000
  115.       Picture         =   "ICOANIM.frx":1546
  116.       Top             =   960
  117.       Visible         =   0   'False
  118.       Width           =   480
  119.    End
  120.    Begin VB.Image Signal 
  121.       Height          =   480
  122.       Index           =   2
  123.       Left            =   3960
  124.       Picture         =   "ICOANIM.frx":1850
  125.       Top             =   2160
  126.       Visible         =   0   'False
  127.       Width           =   480
  128.    End
  129.    Begin VB.Image Signal 
  130.       Height          =   480
  131.       Index           =   1
  132.       Left            =   3480
  133.       Picture         =   "ICOANIM.frx":1B5A
  134.       Top             =   2160
  135.       Visible         =   0   'False
  136.       Width           =   480
  137.    End
  138.    Begin VB.Image Signal 
  139.       Height          =   480
  140.       Index           =   0
  141.       Left            =   3000
  142.       Picture         =   "ICOANIM.frx":1E64
  143.       Top             =   2160
  144.       Visible         =   0   'False
  145.       Width           =   480
  146.    End
  147.    Begin VB.Image Ring 
  148.       Height          =   480
  149.       Index           =   7
  150.       Left            =   4440
  151.       Picture         =   "ICOANIM.frx":216E
  152.       Top             =   480
  153.       Visible         =   0   'False
  154.       Width           =   480
  155.    End
  156.    Begin VB.Image Ring 
  157.       Height          =   480
  158.       Index           =   6
  159.       Left            =   3960
  160.       Picture         =   "ICOANIM.frx":2478
  161.       Top             =   480
  162.       Visible         =   0   'False
  163.       Width           =   480
  164.    End
  165.    Begin VB.Image Ring 
  166.       Height          =   480
  167.       Index           =   5
  168.       Left            =   3480
  169.       Picture         =   "ICOANIM.frx":2782
  170.       Top             =   480
  171.       Visible         =   0   'False
  172.       Width           =   480
  173.    End
  174.    Begin VB.Image Ring 
  175.       Height          =   480
  176.       Index           =   4
  177.       Left            =   3000
  178.       Picture         =   "ICOANIM.frx":2A8C
  179.       Top             =   480
  180.       Visible         =   0   'False
  181.       Width           =   480
  182.    End
  183.    Begin VB.Image Ring 
  184.       Height          =   480
  185.       Index           =   3
  186.       Left            =   4440
  187.       Picture         =   "ICOANIM.frx":2D96
  188.       Top             =   0
  189.       Visible         =   0   'False
  190.       Width           =   480
  191.    End
  192.    Begin VB.Image Ring 
  193.       Height          =   480
  194.       Index           =   2
  195.       Left            =   3960
  196.       Picture         =   "ICOANIM.frx":30A0
  197.       Top             =   0
  198.       Visible         =   0   'False
  199.       Width           =   480
  200.    End
  201.    Begin VB.Image Ring 
  202.       Height          =   480
  203.       Index           =   1
  204.       Left            =   3480
  205.       Picture         =   "ICOANIM.frx":33AA
  206.       Top             =   0
  207.       Visible         =   0   'False
  208.       Width           =   480
  209.    End
  210.    Begin VB.Image Ring 
  211.       Height          =   480
  212.       Index           =   0
  213.       Left            =   3000
  214.       Picture         =   "ICOANIM.frx":36B4
  215.       Top             =   0
  216.       Visible         =   0   'False
  217.       Width           =   480
  218.    End
  219.    Begin VB.Menu mnuFile 
  220.       Caption         =   "&File"
  221.       Begin VB.Menu mnuFileExit 
  222.          Caption         =   "E&xit"
  223.       End
  224.    End
  225. Attribute VB_Name = "IconAnimationForm"
  226. Attribute VB_Creatable = False
  227. Attribute VB_Exposed = False
  228. Option Explicit
  229. Const KIND_RING = 0
  230. Const KIND_FLAME = 1
  231. Const KIND_SIGNAL = 2
  232. Dim Kind As Integer
  233. Dim Idx As Integer
  234. Private Sub Choice_Click(Index As Integer)
  235.     Kind = Index
  236.     Idx = 0
  237.     Select Case Kind
  238.         Case KIND_RING
  239.             Timer1.Interval = 100
  240.         Case KIND_FLAME
  241.             Timer1.Interval = 50
  242.         Case KIND_SIGNAL
  243.             Timer1.Interval = 1000
  244.     End Select
  245. End Sub
  246. Private Sub Form_Unload(Cancel As Integer)
  247.     End
  248. End Sub
  249. Private Sub mnuFileExit_Click()
  250.     Unload Me
  251. End Sub
  252. Private Sub Timer1_Timer()
  253.     Select Case Kind
  254.         Case KIND_RING
  255.             Icon = Ring(Idx).Picture
  256.             Idx = (Idx + 1) Mod 8
  257.         Case KIND_FLAME
  258.             Icon = Flame(Int(8 * Rnd)).Picture
  259.         Case KIND_SIGNAL
  260.             Icon = Signal(Idx).Picture
  261.             If Idx = 1 Then
  262.                 Timer1.Interval = 1000
  263.             Else
  264.                 Timer1.Interval = 2000
  265.             End If
  266.             Idx = (Idx + 1) Mod 3
  267.     End Select
  268. End Sub
  269.