home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / atl / circcoll / circcoll.frm < prev    next >
Text File  |  1998-03-26  |  2KB  |  65 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "CircColl Sample Driver"
  4.    ClientHeight    =   7020
  5.    ClientLeft      =   1152
  6.    ClientTop       =   1368
  7.    ClientWidth     =   8472
  8.    Height          =   7404
  9.    Left            =   1104
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   7020
  12.    ScaleWidth      =   8472
  13.    Top             =   1032
  14.    Width           =   8568
  15.    Begin VB.CommandButton Command1 
  16.       Caption         =   "Get Circle Collection"
  17.       Height          =   495
  18.       Left            =   120
  19.       TabIndex        =   0
  20.       Top             =   120
  21.       Width           =   2295
  22.    End
  23. End
  24. Attribute VB_Name = "Form1"
  25. Attribute VB_Creatable = False
  26. Attribute VB_Exposed = False
  27. Private Sub Command1_Click()
  28.  
  29.     ScaleMode = 3   ' Set scale to pixels.
  30.     FillStyle = 0   ' solid
  31.     
  32.     ' get a collection of objects
  33.     Dim x As New MyCircleCollectionCreator
  34.     Set coll = x.GetCircles(5)
  35.     Cls
  36.     ' draw it using the Circle() primitive
  37.     For i = 1 To coll.Count
  38.         FillColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
  39.         Circle (coll.Item(i).XCenter, coll.Item(i).YCenter), coll.Item(i).Radius
  40.         Print coll.Item(i).Label
  41.     Next i
  42.     
  43.     MsgBox ("Now change values and redraw")
  44.     ' change vaules of objects inside the collection
  45.     For i = 1 To coll.Count
  46.         Set circ = coll.Item(i)
  47.         s = "New "
  48.         s = s + circ.Label
  49.         circ.Radius = circ.Radius * 0.5
  50.         circ.XCenter = circ.XCenter + 50 * i
  51.         circ.YCenter = circ.YCenter + 50 * i
  52.         circ.Label = s
  53.     Next i
  54.     Cls
  55.     ' now redraw to show new values
  56.     For Each circ In coll
  57.         FillColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
  58.         Circle (circ.XCenter, circ.YCenter), circ.Radius, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
  59.         Print circ.Label
  60.     Next circ
  61.  
  62. End Sub
  63.  
  64.  
  65.