home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 6 Unleashed…sional Reference Edition) / Visual_Basic_6_Unleashed_Professional_Reference_Edition_Sams_1999.iso / Source / CHAP05 / 309X0512.TXT < prev    next >
Encoding:
Text File  |  1998-05-27  |  2.1 KB  |  65 lines

  1.  
  2. Private Sub UserControl_InitProperties()
  3.  
  4.      ' If the control's container is in design mode,
  5.      ' disable the Timer, which causes the control to
  6.      ' not function.
  7.      tmrChkStatus.Enabled = Ambient.UserMode
  8.  
  9.      ' Set the default values for some properties.
  10.  
  11.      ' The Caption property defaults to the name
  12.      ' assigned to the control by its container.
  13.      Caption = Ambient.DisplayName
  14.  
  15.      ' The SelColor property defaults to the color
  16.      ' yellow.
  17.      SelColor = &H80FFFF
  18.  
  19.      ' The ButtonMode property defaults to
  20.      ' Text Only Mode (0).
  21.      ButtonMode = [Text Only Mode]
  22.  
  23. End Sub
  24.  
  25.  
  26. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  27.  
  28.      ' If the control's container is in design mode,
  29.      ' disable the Timer, which causes the control to
  30.      ' not function.
  31.      tmrChkStatus.Enabled = Ambient.UserMode
  32.  
  33.      ' Get properties from the property bag.
  34.  
  35.      BackColor = PropBag.ReadProperty("BackColor", &HFFFFFF)
  36.      BorderStyle = PropBag.ReadProperty("BorderStyle", 1)
  37.      ButtonMode = PropBag.ReadProperty("ButtonMode", mmodButtonMode)
  38.      Caption = PropBag.ReadProperty("Caption", Ambient.DisplayName)
  39.      ForeColor = PropBag.ReadProperty("ForeColor", &H80000008)
  40.      SelColor = PropBag.ReadProperty("SelColor", &H80FFFF)
  41.  
  42.      Set Font = PropBag.ReadProperty("Font", mfonFont)
  43.      Set Picture = PropBag.ReadProperty("Picture", Nothing)
  44.      Set SelPicture = PropBag.ReadProperty("SelPicture", Nothing)
  45.  
  46. End Sub
  47.  
  48.  
  49. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  50.  
  51.      ' Save properties to the property bag.
  52.  
  53.      PropBag.WriteProperty "BackColor", BackColor, &HFFFFFF
  54.      PropBag.WriteProperty "BorderStyle", BorderStyle, 1
  55.      PropBag.WriteProperty "ButtonMode", ButtonMode, mmodButtonMode
  56.      PropBag.WriteProperty "Caption", Caption, Ambient.DisplayName
  57.      PropBag.WriteProperty "ForeColor", ForeColor, &H80000008
  58.      PropBag.WriteProperty "SelColor", SelColor, &H80FFFF
  59.  
  60.      PropBag.WriteProperty "Font", Font, mfonFont
  61.      PropBag.WriteProperty "Picture", Picture, Nothing
  62.      PropBag.WriteProperty "SelPicture", SelPicture, Nothing
  63.  
  64. End Sub
  65.