VERSION 5.00
Begin VB.UserControl CoolButton 
   BackStyle       =   0  'Transparent
   ClientHeight    =   2700
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   4440
   ScaleHeight     =   2700
   ScaleWidth      =   4440
   ToolboxBitmap   =   "CoolButton.ctx":0000
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   1000
      Left            =   240
      Top             =   2880
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   495
      Left            =   1080
      TabIndex        =   0
      Top             =   1080
      Width           =   2055
   End
End
Attribute VB_Name = "CoolButton"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
' Event Declarations:

Event Click()
Event DblClick()
Event MouseUp(button As Integer, shift As Integer, x As Single, y As Single)
Event MouseMove(button As Integer, shift As Integer, x As Single, y As Single)
Event MouseDown(button As Integer, shift As Integer, x As Single, y As Single)

' Properties:
Dim m_Caption As String
Const m_def_Caption = ""

Dim m_Size As Integer
Const m_def_Size = 1

' Properties Added

Public Property Get Caption() As String
' Gives the value of our property to the user
  Caption = m_Caption
End Property

Public Property Let Caption(ByVal New_Caption As String)
  ' get a new caption for our property
  m_Caption = New_Caption
  PropertyChanged "Caption"
End Property

Public Property Get Size() As Integer
  Size = m_Size
End Property

Public Property Let Size(ByVal New_Size As Integer)
  m_Size = New_Size
  PropertyChanged "Size"
  
  Call grow(50)
End Property


Private Sub Command1_Click()
  Call UserControl_Click
End Sub

Private Sub Timer1_Timer()
  Call grow(50)
End Sub

' Events Code:

Private Sub UserControl_Click()
  MsgBox "Fatal Error", vbCritical, "ERROR"
  
  Timer1.Enabled = True
  
  RaiseEvent Click
End Sub

Private Sub UserControl_MouseMove(button As Integer, shift As Integer, x As Single, y As Single)
  RaiseEvent MouseMove(button, shift, x, y)
End Sub

Private Sub UserControl_DblClick()
  RaiseEvent DblClick
End Sub
Private Sub UserControl_MouseUp(button As Integer, shift As Integer, x As Single, y As Single)
  RaiseEvent MouseUp(button, shift, x, y)
End Sub
Private Sub UserControl_MouseDown(button As Integer, shift As Integer, x As Single, y As Single)
  RaiseEvent MouseDown(button, shift, x, y)
End Sub

' Methods Added:
Public Sub displayMessage(ByVal Message As String)
  MsgBox Message
End Sub

Public Sub grow(ByVal mySize As Integer)
  
  Command1.Width = Command1.Width + mySize
  Command1.Height = Command1.Height + mySize
  
End Sub



' load property values from storage
Private Sub UserControl_ReadProperties(Propbag As PropertyBag)
  m_Caption = Propbag.ReadProperty("Caption", m_def_Caption)
  m_Size = Propbag.ReadProperty("Size", m_def_Size)
End Sub

' write property values to storage
Private Sub usercontrol_WriteProperties(Propbag As PropertyBag)
  Call Propbag.WriteProperty("Caption", m_Caption, m_def_Caption)
  Call Propbag.WriteProperty("Size", m_Size, m_def_Size)
End Sub











