home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD 12 / 12_pcplus_supercd.iso / Pcplus / VBasic / MYCB.CTL < prev    next >
Encoding:
Text File  |  1997-05-18  |  6.2 KB  |  184 lines

  1. VERSION 5.00
  2. Begin VB.UserControl MyCB 
  3.    ClientHeight    =   2880
  4.    ClientLeft      =   0
  5.    ClientTop       =   0
  6.    ClientWidth     =   3840
  7.    ScaleHeight     =   2880
  8.    ScaleWidth      =   3840
  9.    Begin VB.CommandButton Command1 
  10.       Caption         =   "Command1"
  11.       Height          =   400
  12.       Left            =   1440
  13.       TabIndex        =   0
  14.       Top             =   1200
  15.       Width           =   800
  16.    End
  17. End
  18. Attribute VB_Name = "MyCB"
  19. Attribute VB_GlobalNameSpace = False
  20. Attribute VB_Creatable = True
  21. Attribute VB_PredeclaredId = False
  22. Attribute VB_Exposed = True
  23. Private Declare Function mciSendString Lib _
  24. "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, _
  25. ByVal lpstrReturnString As String, _
  26. ByVal uReturnLength As Long, _
  27. ByVal hwndCallback As Long) As Long
  28.  
  29. 'Default Property Values:
  30. Const m_def_BackColor = 0
  31. Const m_def_ForeColor = 0
  32. Const m_def_Enabled = 0
  33. Const m_def_BackStyle = 0
  34. Const m_def_BorderStyle = 0
  35. Const m_def_Sound = "c:\windows\media\tada.wav"
  36. 'Property Variables:
  37. Dim m_BackColor As Long
  38. Dim m_ForeColor As Long
  39. Dim m_Enabled As Boolean
  40. Dim m_Font As Font
  41. Dim m_BackStyle As Integer
  42. Dim m_BorderStyle As Integer
  43. Dim m_Sound As String
  44. 'Event Declarations:
  45. Event Click() 'MappingInfo=Command1,Command1,-1,Click
  46. Attribute Click.VB_Description = "Occurs when the user presses and then releases a mouse button over an object."
  47. Event DblClick()
  48. Attribute DblClick.VB_Description = "Occurs when the user presses and releases a mouse button and then presses and releases it again over an object."
  49. Event KeyDown(KeyCode As Integer, Shift As Integer)
  50. Attribute KeyDown.VB_Description = "Occurs when the user presses a key while an object has the focus."
  51. Event KeyPress(KeyAscii As Integer)
  52. Attribute KeyPress.VB_Description = "Occurs when the user presses and releases an ANSI key."
  53. Event KeyUp(KeyCode As Integer, Shift As Integer)
  54. Attribute KeyUp.VB_Description = "Occurs when the user releases a key while an object has the focus."
  55. Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  56. Attribute MouseDown.VB_Description = "Occurs when the user presses the mouse button while an object has the focus."
  57. Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  58. Attribute MouseMove.VB_Description = "Occurs when the user moves the mouse."
  59. Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  60. Attribute MouseUp.VB_Description = "Occurs when the user releases the mouse button while an object has the focus."
  61.  
  62.  
  63.  
  64. Public Property Get BackColor() As Long
  65.     BackColor = m_BackColor
  66. End Property
  67.  
  68. Public Property Let BackColor(ByVal New_BackColor As Long)
  69.     m_BackColor = New_BackColor
  70.     PropertyChanged "BackColor"
  71. End Property
  72.  
  73. Public Property Get ForeColor() As Long
  74.     ForeColor = m_ForeColor
  75. End Property
  76.  
  77. Public Property Let ForeColor(ByVal New_ForeColor As Long)
  78.     m_ForeColor = New_ForeColor
  79.     PropertyChanged "ForeColor"
  80. End Property
  81.  
  82. Public Property Get Enabled() As Boolean
  83.     Enabled = m_Enabled
  84. End Property
  85.  
  86. Public Property Let Enabled(ByVal New_Enabled As Boolean)
  87.     m_Enabled = New_Enabled
  88.     PropertyChanged "Enabled"
  89. End Property
  90.  
  91. Public Property Get Font() As Font
  92.     Set Font = m_Font
  93. End Property
  94.  
  95. Public Property Set Font(ByVal New_Font As Font)
  96.     Set m_Font = New_Font
  97.     PropertyChanged "Font"
  98. End Property
  99.  
  100. Public Property Get BackStyle() As Integer
  101.     BackStyle = m_BackStyle
  102. End Property
  103.  
  104. Public Property Let BackStyle(ByVal New_BackStyle As Integer)
  105.     m_BackStyle = New_BackStyle
  106.     PropertyChanged "BackStyle"
  107. End Property
  108.  
  109. Public Property Get BorderStyle() As Integer
  110.     BorderStyle = m_BorderStyle
  111. End Property
  112.  
  113. Public Property Let BorderStyle(ByVal New_BorderStyle As Integer)
  114.     m_BorderStyle = New_BorderStyle
  115.     PropertyChanged "BorderStyle"
  116. End Property
  117.  
  118. Public Sub Refresh()
  119.      
  120. End Sub
  121.  
  122. Private Sub Command1_Click()
  123.     Call mciSendString("play " + Sound, 0, 0, 0)
  124.     RaiseEvent Click
  125. End Sub
  126.  
  127. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  128. 'MappingInfo=Command1,Command1,-1,Caption
  129. Public Property Get Caption() As String
  130.     Caption = Command1.Caption
  131. End Property
  132.  
  133. Public Property Let Caption(ByVal New_Caption As String)
  134.     Command1.Caption() = New_Caption
  135.     PropertyChanged "Caption"
  136. End Property
  137.  
  138. Public Property Get Sound() As String
  139.     Sound = m_Sound
  140. End Property
  141.  
  142. Public Property Let Sound(ByVal New_Sound As String)
  143.     m_Sound = New_Sound
  144.     PropertyChanged "Sound"
  145. End Property
  146.  
  147. 'Initialize Properties for User Control
  148. Private Sub UserControl_InitProperties()
  149.     m_BackColor = m_def_BackColor
  150.     m_ForeColor = m_def_ForeColor
  151.     m_Enabled = m_def_Enabled
  152.     Set m_Font = Ambient.Font
  153.     m_BackStyle = m_def_BackStyle
  154.     m_BorderStyle = m_def_BorderStyle
  155.     m_Sound = m_def_Sound
  156. End Sub
  157.  
  158. 'Load property values from storage
  159. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  160.  
  161.     m_BackColor = PropBag.ReadProperty("BackColor", m_def_BackColor)
  162.     m_ForeColor = PropBag.ReadProperty("ForeColor", m_def_ForeColor)
  163.     m_Enabled = PropBag.ReadProperty("Enabled", m_def_Enabled)
  164.     Set m_Font = PropBag.ReadProperty("Font", Ambient.Font)
  165.     m_BackStyle = PropBag.ReadProperty("BackStyle", m_def_BackStyle)
  166.     m_BorderStyle = PropBag.ReadProperty("BorderStyle", m_def_BorderStyle)
  167.     Command1.Caption = PropBag.ReadProperty("Caption", "Command1")
  168.     m_Sound = PropBag.ReadProperty("Sound", m_def_Sound)
  169. End Sub
  170.  
  171. 'Write property values to storage
  172. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  173.  
  174.     Call PropBag.WriteProperty("BackColor", m_BackColor, m_def_BackColor)
  175.     Call PropBag.WriteProperty("ForeColor", m_ForeColor, m_def_ForeColor)
  176.     Call PropBag.WriteProperty("Enabled", m_Enabled, m_def_Enabled)
  177.     Call PropBag.WriteProperty("Font", m_Font, Ambient.Font)
  178.     Call PropBag.WriteProperty("BackStyle", m_BackStyle, m_def_BackStyle)
  179.     Call PropBag.WriteProperty("BorderStyle", m_BorderStyle, m_def_BorderStyle)
  180.     Call PropBag.WriteProperty("Caption", Command1.Caption, "Command1")
  181.     Call PropBag.WriteProperty("Sound", m_Sound, m_def_Sound)
  182. End Sub
  183.  
  184.