home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH13 / 13-2-3C.CLS < prev    next >
Encoding:
Visual Basic class definition  |  1998-11-02  |  1.5 KB  |  58 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "CCircle"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14.  
  15. Private m_x As Integer  'Distance from center of circle to left side of form
  16. Private m_y As Integer  'Distance from center of circle to top of form
  17. Private m_r As Single   'Radius of circle
  18. Public Event PositionChanged(x As Integer, y As Integer, zc As Single) 'Triggered by change in center of circle
  19.  
  20. Private Sub Class_Initialize()
  21.   'Set the initial center of the circle to the upper
  22.   'left corner of the form and set its radius to 500.
  23.   m_x = 0
  24.   m_y = 0
  25.   m_r = 500
  26. End Sub
  27.  
  28. Public Property Get Xcoord() As Integer
  29.   Xcoord = m_x
  30. End Property
  31.  
  32. Public Property Let Xcoord(ByVal vNewValue As Integer)
  33.   m_x = vNewValue
  34. End Property
  35.  
  36. Public Property Get Ycoord() As Integer
  37.   Ycoord = m_y
  38. End Property
  39.  
  40. Public Property Let Ycoord(ByVal vNewValue As Integer)
  41.   m_y = vNewValue
  42. End Property
  43.  
  44. Public Sub Show()
  45.   'Display the circle.
  46.   'See discussion of Circle method in Section 10.4.
  47.   frmCircles.Circle (m_x, m_y), m_r
  48. End Sub
  49.  
  50. Public Sub Move(Dist)
  51.   'Move the center of the circle Dist twips to the right
  52.   'and Dist twips down.
  53.   m_x = m_x + Dist
  54.   m_y = m_y + Dist
  55.   RaiseEvent PositionChanged(m_x, m_y, m_r)
  56.   Call Show
  57. End Sub
  58.