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 / 309X0511.TXT < prev    next >
Encoding:
Text File  |  1998-05-27  |  5.3 KB  |  193 lines

  1.  
  2. Public Property Get BackColor() As OLE_COLOR
  3.  
  4.      ' The control's BackColor property is "stored" in
  5.      ' the UserControl object's BackColor property.
  6.      BackColor = UserControl.BackColor
  7.  
  8. End Property
  9.  
  10.  
  11. Public Property Let BackColor(ByVal NewValue As OLE_COLOR)
  12.  
  13.      ' The control's new BackColor value is passed
  14.      ' directly to the UserControl object's BackColor
  15.      ' property.
  16.      UserControl.BackColor = NewValue
  17.      UserControl.PropertyChanged "BackColor"
  18.  
  19.      ' Store the new BackColor value in a "holding"
  20.      ' variable for later use.
  21.      molcBackColor = NewValue
  22.  
  23. End Property
  24.  
  25.  
  26. Public Property Get BorderStyle() As lbBorderStyleTypes
  27.  
  28.      ' The control's BorderStyle property is "stored" in
  29.      ' the UserControl object's BorderStyle property.
  30.      BorderStyle = UserControl.BorderStyle
  31.  
  32. End Property
  33.  
  34.  
  35. Public Property Let BorderStyle(ByVal NewValue As lbBorderStyleTypes)
  36.  
  37.      ' Make sure that the value being assigned to the
  38.      ' BorderStyle property is valid.
  39.      If NewValue = None Or NewValue = [Fixed Single] Then
  40.           ' The control's new BorderStyle value is passed
  41.           ' directly to the UserControl object's BorderStyle
  42.           ' property.
  43.           UserControl.BorderStyle = NewValue
  44.           UserControl.PropertyChanged "BorderStyle"
  45.      Else
  46.           ' Invalid BorderStyle value - raise an error.
  47.           Err.Raise Number:=vbObjectError + 32112, _
  48.                Description:="Invalid BorderStyle value (0 or 1 only)"
  49.      End If
  50.  
  51. End Property
  52.  
  53.  
  54. Public Property Get ButtonMode() As lbModeTypes
  55.  
  56.      ' The ButtonMode property is stored in a "holding"
  57.      ' variable, mmodButtonMode.
  58.      ButtonMode = mmodButtonMode
  59.  
  60. End Property
  61.  
  62.  
  63. Public Property Let ButtonMode(ByVal NewValue As lbModeTypes)
  64.  
  65.      ' Don't let a new value be assigned to
  66.      ' mmodButtonMode (ButtonMode's "holding" variable)
  67.      ' unless it is valid.
  68.      If NewValue = [Text Only Mode] Or NewValue = [Image Mode] Then
  69.           mmodButtonMode = NewValue
  70.           ' If ButtonMode is Text Only Mode (0), show
  71.           ' the lblCaption object. If ButtonMode is
  72.           ' Image Mode (1), hide the lblCaption object.
  73.           If mmodButtonMode = [Text Only Mode] Then lblCaption.Visible = True
  74.           If mmodButtonMode = [Image Mode] Then lblCaption.Visible = False
  75.           UserControl.PropertyChanged "ButtonMode"
  76.      Else
  77.           ' Invalid ButtonMode value - raise an error.
  78.           Err.Raise Number:=vbObjectError + 32113, _
  79.                Description:="Invalid ButtonMode value (0 or 1 only)"
  80.      End If
  81.  
  82. End Property
  83.  
  84.  
  85. Public Property Get Font() As StdFont
  86.  
  87.      ' The value for the control's Font property is
  88.      ' "stored" in the lblCaption object's Font property.
  89.      Set Font = lblCaption.Font
  90.  
  91. End Property
  92.  
  93.  
  94. Public Property Set Font(ByVal NewValue As StdFont)
  95.  
  96.      ' Store the control's new Font value in the
  97.      ' lblCaption object's Font property.
  98.      Set lblCaption.Font = NewValue
  99.      UserControl.PropertyChanged "Font"
  100.  
  101. End Property
  102.  
  103.  
  104. Public Property Get ForeColor() As OLE_COLOR
  105.  
  106.      ' The control's ForeColor property is "stored" in
  107.      ' lblCaption's ForeColor property.
  108.      ForeColor = lblCaption.ForeColor
  109.  
  110. End Property
  111.  
  112.  
  113. Public Property Let ForeColor(ByVal NewValue As OLE_COLOR)
  114.  
  115.      ' The control's new ForeColor value is passed
  116.      ' directly to lblCaption's ForeColor property.
  117.      lblCaption.ForeColor = NewValue
  118.      UserControl.PropertyChanged "ForeColor"
  119.  
  120. End Property
  121.  
  122.  
  123. Public Property Get Picture() As StdPicture
  124.  
  125.      ' The control's Picture property is "stored" in
  126.      ' the UserControl object's Picture property.
  127.      Set Picture = UserControl.Picture
  128.  
  129. End Property
  130.  
  131.  
  132. Public Property Set Picture(ByVal NewValue As StdPicture)
  133.  
  134.      ' First, change UserControl's Picture property to
  135.      ' display the image selected.
  136.      Set UserControl.Picture = NewValue
  137.  
  138.      ' Then store the new image in a "holding" picture
  139.      ' object.
  140.      Set mpicPicture = NewValue
  141.  
  142.      ' If Picture's image is Nothing, set the ButtonMode
  143.      ' property back to Text Only Mode (0). If Picture
  144.      ' does contain an image, set the ButtonMode
  145.      ' property to Image Mode (1).
  146.      If NewValue Is Nothing Then
  147.           ButtonMode = [Text Only Mode]
  148.      Else
  149.           ButtonMode = [Image Mode]
  150.      End If
  151.  
  152.      UserControl.PropertyChanged "Picture"
  153.  
  154. End Property
  155.  
  156.  
  157. Public Property Get SelColor() As OLE_COLOR
  158.  
  159.      ' The control's SelColor property is stored in a
  160.      ' "holding" variable, molcSelColor.
  161.      SelColor = molcSelColor
  162.  
  163. End Property
  164.  
  165.  
  166. Public Property Let SelColor(ByVal NewValue As OLE_COLOR)
  167.  
  168.      ' Store SelColor's new value in a "holding"
  169.      ' variable, molcSelColor.
  170.      molcSelColor = NewValue
  171.      UserControl.PropertyChanged "SelColor"
  172.  
  173. End Property
  174.  
  175.  
  176. Public Property Get SelPicture() As StdPicture
  177.  
  178.      ' SelPicture's image is retrieved from a "holding"
  179.      ' picture object, mpicSelPicture.
  180.      Set SelPicture = mpicSelPicture
  181.  
  182. End Property
  183.  
  184.  
  185. Public Property Set SelPicture(ByVal NewValue As StdPicture)
  186.  
  187.      ' Store SelPicture's new value in a "holding"
  188.      ' picture object, mpicSelPicture.
  189.      Set mpicSelPicture = NewValue
  190.      UserControl.PropertyChanged "SelPicture"
  191.  
  192. End Property
  193.