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-1-3C.CLS < prev    next >
Encoding:
Visual Basic class definition  |  1998-09-18  |  1.2 KB  |  51 lines

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