home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / ch_code / ch16 / flxlabel / label3d.ctl (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-05-13  |  21.4 KB  |  482 lines

  1. VERSION 5.00
  2. Begin VB.UserControl Label3D 
  3.    AutoRedraw      =   -1  'True
  4.    ClientHeight    =   2865
  5.    ClientLeft      =   0
  6.    ClientTop       =   0
  7.    ClientWidth     =   5145
  8.    ControlContainer=   -1  'True
  9.    BeginProperty Font 
  10.       Name            =   "Verdana"
  11.       Size            =   12
  12.       Charset         =   0
  13.       Weight          =   700
  14.       Underline       =   0   'False
  15.       Italic          =   0   'False
  16.       Strikethrough   =   0   'False
  17.    EndProperty
  18.    PropertyPages   =   "Label3D.ctx":0000
  19.    ScaleHeight     =   2865
  20.    ScaleWidth      =   5145
  21. Attribute VB_Name = "Label3D"
  22. Attribute VB_GlobalNameSpace = False
  23. Attribute VB_Creatable = True
  24. Attribute VB_PredeclaredId = False
  25. Attribute VB_Exposed = True
  26. Attribute VB_Ext_KEY = "PropPageWizardRun" ,"Yes"
  27. '  ******************************
  28. '  ******************************
  29. '  ** MASTERING VB6            **
  30. '  ** by Evangelos Petroutos   **
  31. '  ** SYBEX, 1998              **
  32. '  ******************************
  33. '  ******************************
  34. Enum Effects
  35.     None
  36.     [Carved Light]
  37.     Carved
  38.     [Carved Heavy]
  39.     [Raised Light]
  40.     Raised
  41.     [Raised Heavy]
  42. End Enum
  43. Enum Align
  44.     [Top Left]
  45.     [Top Middle]
  46.     [Top Right]
  47.     [Center Left]
  48.     [Center Middle]
  49.     [Center Right]
  50.     [Bottom Left]
  51.     [Bottom Middle]
  52.     [Bottom Right]
  53. End Enum
  54. Enum BackgroundStyle
  55.     Transparent
  56.     Opaque
  57. End Enum
  58. Private m_Caption As String
  59. Private m_Effect As Effects
  60. Private m_TextAlignment As Align
  61. 'Default Property Values:
  62. Const m_def_Caption = "3D Label"
  63. Const m_def_Effect = 2
  64. Const m_def_TextAlignment = 4
  65. 'Property Variables:
  66. 'Event Declarations:
  67. Event DblClick() 'MappingInfo=UserControl,UserControl,-1,DblClick
  68. Attribute DblClick.VB_Description = "Occurs when the user presses and releases a mouse button and then presses and releases it again over an object."
  69. Event Click() 'MappingInfo=UserControl,UserControl,-1,Click
  70. Attribute Click.VB_Description = "Occurs when the user presses and then releases a mouse button over an object."
  71. Event KeyUp(KeyCode As Integer, Shift As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyUp
  72. Attribute KeyUp.VB_Description = "Occurs when the user releases a key while an object has the focus."
  73. Event KeyPress(KeyAscii As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyPress
  74. Attribute KeyPress.VB_Description = "Occurs when the user presses and releases an ANSI key."
  75. Event KeyDown(KeyCode As Integer, Shift As Integer) 'MappingInfo=UserControl,UserControl,-1,KeyDown
  76. Attribute KeyDown.VB_Description = "Occurs when the user presses a key while an object has the focus."
  77. Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseUp
  78. Attribute MouseUp.VB_Description = "Occurs when the user releases the mouse button while an object has the focus."
  79. Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=UserControl,UserControl,-1,MouseMove
  80. Attribute MouseMove.VB_Description = "Occurs when the user moves the mouse."
  81. Event OLEStartDrag(Data As DataObject, AllowedEffects As Long) 'MappingInfo=UserControl,UserControl,-1,OLEStartDrag
  82. Attribute OLEStartDrag.VB_Description = "Occurs when an OLE drag/drop operation is initiated either manually or automatically."
  83. Event OLESetData(Data As DataObject, DataFormat As Integer) 'MappingInfo=UserControl,UserControl,-1,OLESetData
  84. Attribute OLESetData.VB_Description = "Occurs at the OLE drag/drop source control when the drop target requests data that was not provided to the DataObject during the OLEDragStart event."
  85. Event OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean) 'MappingInfo=UserControl,UserControl,-1,OLEGiveFeedback
  86. Attribute OLEGiveFeedback.VB_Description = "Occurs at the source control of an OLE drag/drop operation when the mouse cursor needs to be changed."
  87. Event OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer) 'MappingInfo=UserControl,UserControl,-1,OLEDragOver
  88. Attribute OLEDragOver.VB_Description = "Occurs when the mouse is moved over the control during an OLE drag/drop operation, if its OLEDropMode property is set to manual."
  89. Event OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=UserControl,UserControl,-1,OLEDragDrop
  90. Attribute OLEDragDrop.VB_Description = "Occurs when data is dropped onto the control via an OLE drag/drop operation, and OLEDropMode is set to manual."
  91. Event Resize() 'MappingInfo=UserControl,UserControl,-1,Resize
  92. Attribute Resize.VB_Description = "Occurs when a form is first displayed or the size of an object changes."
  93. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  94. 'MappingInfo=UserControl,UserControl,-1,Font
  95. Public Property Get Font() As Font
  96. Attribute Font.VB_Description = "Returns a Font object."
  97. Attribute Font.VB_UserMemId = -512
  98.     Set Font = UserControl.Font
  99. End Property
  100. Public Property Set Font(ByVal New_Font As Font)
  101.     Set UserControl.Font = New_Font
  102.     PropertyChanged "Font"
  103.     UserControl_Paint
  104. End Property
  105. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  106. 'MappingInfo=UserControl,UserControl,-1,BorderStyle
  107. Public Property Get BorderStyle() As Integer
  108. Attribute BorderStyle.VB_Description = "Returns/sets the border style for an object."
  109.     BorderStyle = UserControl.BorderStyle
  110. End Property
  111. Public Property Let BorderStyle(ByVal New_BorderStyle As Integer)
  112.     UserControl.BorderStyle() = New_BorderStyle
  113.     PropertyChanged "BorderStyle"
  114. End Property
  115. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  116. 'MappingInfo=UserControl,UserControl,-1,BackStyle
  117. Public Property Get BackStyle() As BackgroundStyle
  118. Attribute BackStyle.VB_Description = "Indicates whether a Label or the background of a Shape is transparent or opaque."
  119.     BackStyle = UserControl.BackStyle
  120. End Property
  121. Public Property Let BackStyle(ByVal New_BackStyle As BackgroundStyle)
  122.     UserControl.BackStyle() = New_BackStyle
  123.     PropertyChanged "BackStyle"
  124. End Property
  125. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  126. 'MappingInfo=UserControl,UserControl,-1,Appearance
  127. Public Property Get Appearance() As Integer
  128. Attribute Appearance.VB_Description = "Returns/sets whether or not an object is painted at run time with 3-D effects."
  129.     Appearance = UserControl.Appearance
  130. End Property
  131. Private Sub UserControl_DblClick()
  132.     RaiseEvent DblClick
  133. End Sub
  134. Private Sub UserControl_Click()
  135. Dim ExtProp As String
  136.     ExtProp = "I'm a custom control. My name is " _
  137.               & UserControl.Extender.Name
  138.     ExtProp = ExtProp & "I'm located at (" & UserControl.Extender.Left _
  139.               & ", " & UserControl.Extender.Left & ")"
  140.     ExtProp = ExtProp & vbCrLf & " My dimensions are " _
  141.               & UserControl.Extender.Width & " by " _
  142.               & UserControl.Extender.Height
  143.     ExtProp = ExtProp & vbCrLf & "I'm tagged as " _
  144.               & UserControl.Extender.Tag
  145.     ExtProp = ExtProp & vbCrLf & "I'm sited on a control named " _
  146.               & UserControl.Extender.Parent.Name
  147.     ExtProp = ExtProp & vbCrLf & "whose dimensions are " _
  148.               & UserControl.Extender.Parent.Width _
  149.               & " by " & UserControl.Extender.Parent.Height
  150.     MsgBox ExtProp
  151.     RaiseEvent Click
  152. End Sub
  153. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  154. 'MappingInfo=UserControl,UserControl,-1,Enabled
  155. Public Property Get Enabled() As Boolean
  156. Attribute Enabled.VB_Description = "Returns/sets a value that determines whether an object can respond to user-generated events."
  157.     Enabled = UserControl.Enabled
  158. End Property
  159. Public Property Let Enabled(ByVal New_Enabled As Boolean)
  160.     UserControl.Enabled() = New_Enabled
  161.     PropertyChanged "Enabled"
  162. End Property
  163. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  164. 'MappingInfo=UserControl,UserControl,-1,ForeColor
  165. Public Property Get ForeColor() As OLE_COLOR
  166. Attribute ForeColor.VB_Description = "Returns/sets the foreground color used to display text and graphics in an object."
  167.     ForeColor = UserControl.ForeColor
  168. End Property
  169. Public Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR)
  170.     UserControl.ForeColor() = New_ForeColor
  171.     PropertyChanged "ForeColor"
  172.     UserControl_Paint
  173. End Property
  174. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  175. 'MappingInfo=UserControl,UserControl,-1,hDC
  176. Public Property Get hDC() As Long
  177. Attribute hDC.VB_Description = "Returns a handle (from Microsoft Windows) to the object's device context."
  178.     hDC = UserControl.hDC
  179. End Property
  180. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  181. 'MappingInfo=UserControl,UserControl,-1,hWnd
  182. Public Property Get hWnd() As Long
  183. Attribute hWnd.VB_Description = "Returns a handle (from Microsoft Windows) to an object's window."
  184.     hWnd = UserControl.hWnd
  185. End Property
  186. Private Sub UserControl_KeyUp(KeyCode As Integer, Shift As Integer)
  187.     RaiseEvent KeyUp(KeyCode, Shift)
  188. End Sub
  189. Private Sub UserControl_KeyPress(KeyAscii As Integer)
  190.     RaiseEvent KeyPress(KeyAscii)
  191. End Sub
  192. Private Sub UserControl_KeyDown(KeyCode As Integer, Shift As Integer)
  193.     RaiseEvent KeyDown(KeyCode, Shift)
  194. End Sub
  195. Private Sub UserControl_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  196.     RaiseEvent MouseUp(Button, Shift, X, Y)
  197. End Sub
  198. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  199. 'MappingInfo=UserControl,UserControl,-1,MousePointer
  200. Public Property Get MousePointer() As Integer
  201. Attribute MousePointer.VB_Description = "Returns/sets the type of mouse pointer displayed when over part of an object."
  202.     MousePointer = UserControl.MousePointer
  203. End Property
  204. Public Property Let MousePointer(ByVal New_MousePointer As Integer)
  205.     UserControl.MousePointer() = New_MousePointer
  206.     PropertyChanged "MousePointer"
  207. End Property
  208. Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  209.     RaiseEvent MouseMove(Button, Shift, X, Y)
  210. End Sub
  211. Private Sub UserControl_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
  212.     RaiseEvent OLEStartDrag(Data, AllowedEffects)
  213. End Sub
  214. Private Sub UserControl_OLESetData(Data As DataObject, DataFormat As Integer)
  215.     RaiseEvent OLESetData(Data, DataFormat)
  216. End Sub
  217. Private Sub UserControl_OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean)
  218.     RaiseEvent OLEGiveFeedback(Effect, DefaultCursors)
  219. End Sub
  220. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  221. 'MappingInfo=UserControl,UserControl,-1,OLEDropMode
  222. Public Property Get OLEDropMode() As Integer
  223. Attribute OLEDropMode.VB_Description = "Returns/Sets whether this object can act as an OLE drop target."
  224.     OLEDropMode = UserControl.OLEDropMode
  225. End Property
  226. Public Property Let OLEDropMode(ByVal New_OLEDropMode As Integer)
  227.     UserControl.OLEDropMode() = New_OLEDropMode
  228.     PropertyChanged "OLEDropMode"
  229. End Property
  230. Private Sub UserControl_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)
  231.     RaiseEvent OLEDragOver(Data, Effect, Button, Shift, X, Y, State)
  232. End Sub
  233. Private Sub UserControl_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
  234.     RaiseEvent OLEDragDrop(Data, Effect, Button, Shift, X, Y)
  235. End Sub
  236. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  237. 'MappingInfo=UserControl,UserControl,-1,OLEDrag
  238. Public Sub OLEDrag()
  239. Attribute OLEDrag.VB_Description = "Starts an OLE drag/drop event with the given control as the source."
  240.     UserControl.OLEDrag
  241. End Sub
  242. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  243. 'MappingInfo=UserControl,UserControl,-1,Picture
  244. Public Property Get Picture() As Picture
  245. Attribute Picture.VB_Description = "Returns/sets a graphic to be displayed in a control."
  246.     Set Picture = UserControl.Picture
  247. End Property
  248. Public Property Set Picture(ByVal New_Picture As Picture)
  249.     Set UserControl.Picture = New_Picture
  250.     PropertyChanged "Picture"
  251.     UserControl_Paint
  252. End Property
  253. Private Sub UserControl_Paint()
  254.     DrawCaption
  255.     OldFontSize = UserControl.Font.Size
  256.     UserControl.Font.Size = 10
  257.     If Not Ambient.UserMode Then
  258.         UserControl.CurrentX = 0
  259.         UserControl.CurrentY = 0
  260.         UserControl.Print "Design Mode"
  261.     End If
  262.     UserControl.Font.Size = OldFontSize
  263. End Sub
  264. Private Sub UserControl_Resize()
  265.     UserControl_Paint
  266.     RaiseEvent Resize
  267. End Sub
  268. Public Property Get Caption() As String
  269. Attribute Caption.VB_ProcData.VB_Invoke_Property = "CaptionProperties"
  270. Attribute Caption.VB_UserMemId = -518
  271.     Caption = m_Caption
  272. End Property
  273. Public Property Let Caption(ByVal New_Caption As String)
  274.     m_Caption = New_Caption
  275.     PropertyChanged "Caption"
  276.     UserControl_Paint
  277. End Property
  278. Public Property Get Effect() As Effects
  279.     Effect = m_Effect
  280. End Property
  281. Public Property Let Effect(ByVal New_Effect As Effects)
  282.     m_Effect = New_Effect
  283.     PropertyChanged "Effect"
  284.     UserControl_Paint
  285. End Property
  286. Public Property Get TextAlignment() As Align
  287. Attribute TextAlignment.VB_Description = "Determines how the caption will be aligned on the control"
  288.     TextAlignment = m_TextAlignment
  289. End Property
  290. Public Property Let TextAlignment(ByVal New_TextAlignment As Align)
  291.     m_TextAlignment = New_TextAlignment
  292.     PropertyChanged "TextAlignment"
  293.     UserControl_Paint
  294. End Property
  295. 'Initialize Properties for User Control
  296. Private Sub UserControl_InitProperties()
  297.     Set Font = Ambient.Font
  298.     m_Caption = m_def_Caption
  299.     m_Effect = m_def_Effect
  300.     m_TextAlignment = m_def_TextAlignment
  301.     UserControl.BorderStyle = 1
  302.     UserControl.BackStyle = 1
  303.     UserControl_Paint
  304. End Sub
  305. 'Load property values from storage
  306. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  307.     Set Font = PropBag.ReadProperty("Font", Ambient.Font)
  308.     UserControl.BorderStyle = PropBag.ReadProperty("BorderStyle", 0)
  309.     UserControl.BackStyle = PropBag.ReadProperty("BackStyle", 1)
  310.     UserControl.Enabled = PropBag.ReadProperty("Enabled", True)
  311.     UserControl.ForeColor = PropBag.ReadProperty("ForeColor", &H80000012)
  312.     UserControl.MousePointer = PropBag.ReadProperty("MousePointer", 0)
  313.     UserControl.OLEDropMode = PropBag.ReadProperty("OLEDropMode", 0)
  314.     Set Picture = PropBag.ReadProperty("Picture", Nothing)
  315.     m_Caption = PropBag.ReadProperty("Caption", m_def_Caption)
  316.     m_Effect = PropBag.ReadProperty("Effect", m_def_Effect)
  317.     m_TextAlignment = PropBag.ReadProperty("TextAlignment", m_def_TextAlignment)
  318.     UserControl.BackColor = PropBag.ReadProperty("BackColor", &H8000000F)
  319. End Sub
  320. Private Sub UserControl_Show()
  321.     UserControl_Paint
  322. End Sub
  323. 'Write property values to storage
  324. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  325.     Call PropBag.WriteProperty("Font", Font, Ambient.Font)
  326.     Call PropBag.WriteProperty("BorderStyle", UserControl.BorderStyle, 0)
  327.     Call PropBag.WriteProperty("BackStyle", UserControl.BackStyle, 1)
  328.     Call PropBag.WriteProperty("Enabled", UserControl.Enabled, True)
  329.     Call PropBag.WriteProperty("ForeColor", UserControl.ForeColor, &H80000012)
  330.     Call PropBag.WriteProperty("MousePointer", UserControl.MousePointer, 0)
  331.     Call PropBag.WriteProperty("OLEDropMode", UserControl.OLEDropMode, 0)
  332.     Call PropBag.WriteProperty("Picture", Picture, Nothing)
  333.     Call PropBag.WriteProperty("Caption", m_Caption, m_def_Caption)
  334.     Call PropBag.WriteProperty("Effect", m_Effect, m_def_Effect)
  335.     Call PropBag.WriteProperty("TextAlignment", m_TextAlignment, m_def_TextAlignment)
  336.     Call PropBag.WriteProperty("BackColor", UserControl.BackColor, &H8000000F)
  337. End Sub
  338. Private Sub DrawCaption()
  339. Dim CaptionWidth As Long, CaptionHeight As Long
  340. Dim CurrX As Long, CurrY As Long
  341. Dim oldForeColor As OLE_COLOR
  342.     CaptionHeight = TextHeight(m_Caption)
  343.     CaptionWidth = TextWidth(m_Caption)
  344.     Select Case m_TextAlignment
  345.         Case 0:
  346.             CurrX = 30
  347.             CurrY = 0
  348.         Case 1:
  349.             CurrX = (UserControl.Width - CaptionWidth) / 2
  350.             CurrY = 0
  351.         Case 2:
  352.             CurrX = UserControl.Width - CaptionWidth - 30
  353.             CurrY = 0
  354.         Case 3:
  355.             CurrX = 30
  356.             CurrY = (UserControl.Height - CaptionHeight) / 2
  357.         Case 4:
  358.             CurrX = (UserControl.Width - CaptionWidth) / 2
  359.             CurrY = (UserControl.Height - CaptionHeight) / 2
  360.         Case 5:
  361.             CurrX = UserControl.Width - CaptionWidth - 30
  362.             CurrY = (UserControl.Height - CaptionHeight) / 2
  363.         Case 6:
  364.             CurrX = 30
  365.             CurrY = UserControl.Height - CaptionHeight - 45
  366.         Case 7:
  367.             CurrX = (UserControl.Width - CaptionWidth) / 2
  368.             CurrY = UserControl.Height - CaptionHeight - 45
  369.         Case 8:
  370.             CurrX = UserControl.Width - CaptionWidth - 30
  371.             CurrY = UserControl.Height - CaptionHeight - 45
  372.     End Select
  373.         
  374.     oldForeColor = UserControl.ForeColor
  375.     Select Case m_Effect
  376.         Case 0:
  377.             UserControl.Cls
  378.             UserControl.CurrentX = CurrX
  379.             UserControl.CurrentY = CurrY
  380.             UserControl.Print m_Caption
  381.         Case 1:
  382.             UserControl.Cls
  383.             UserControl.CurrentX = CurrX + 15
  384.             UserControl.CurrentY = CurrY + 15
  385.             UserControl.ForeColor = RGB(255, 255, 255)
  386.             UserControl.Print m_Caption
  387.             UserControl.CurrentX = CurrX
  388.             UserControl.CurrentY = CurrY
  389.             UserControl.ForeColor = oldForeColor
  390.             UserControl.Print m_Caption
  391.         Case 2:
  392.             UserControl.Cls
  393.             UserControl.CurrentX = CurrX + 30
  394.             UserControl.CurrentY = CurrY + 30
  395.             UserControl.ForeColor = RGB(255, 255, 255)
  396.             UserControl.Print m_Caption
  397.             UserControl.CurrentX = CurrX
  398.             UserControl.CurrentY = CurrY
  399.             UserControl.ForeColor = oldForeColor
  400.             UserControl.Print m_Caption
  401.         Case 3:
  402.             UserControl.Cls
  403.             UserControl.CurrentX = CurrX + 45
  404.             UserControl.CurrentY = CurrY + 45
  405.             UserControl.ForeColor = RGB(255, 255, 255)
  406.             UserControl.Print m_Caption
  407.             
  408.             UserControl.CurrentX = CurrX + 30
  409.             UserControl.CurrentY = CurrY + 30
  410.             UserControl.ForeColor = RGB(255, 255, 255)
  411.             UserControl.Print m_Caption
  412.             
  413.             UserControl.CurrentX = CurrX + 15
  414.             UserControl.CurrentY = CurrY + 15
  415.             UserControl.ForeColor = RGB(255, 255, 255)
  416.             UserControl.Print m_Caption
  417.             
  418.             UserControl.CurrentX = CurrX
  419.             UserControl.CurrentY = CurrY
  420.             UserControl.ForeColor = oldForeColor
  421.             UserControl.Print m_Caption
  422.         Case 4:
  423.             UserControl.Cls
  424.             UserControl.CurrentX = CurrX - 15
  425.             UserControl.CurrentY = CurrY - 15
  426.             UserControl.ForeColor = RGB(255, 255, 255)
  427.             UserControl.Print m_Caption
  428.             UserControl.CurrentX = CurrX
  429.             UserControl.CurrentY = CurrY
  430.             UserControl.ForeColor = oldForeColor
  431.             UserControl.Print m_Caption
  432.         Case 5:
  433.             UserControl.Cls
  434.             UserControl.CurrentX = CurrX - 30
  435.             UserControl.CurrentY = CurrY - 30
  436.             UserControl.ForeColor = RGB(255, 255, 255)
  437.             UserControl.Print m_Caption
  438.             UserControl.CurrentX = CurrX
  439.             UserControl.CurrentY = CurrY
  440.             UserControl.ForeColor = oldForeColor
  441.             UserControl.Print m_Caption
  442.         Case 6:
  443.             UserControl.Cls
  444.             UserControl.CurrentX = CurrX - 45
  445.             UserControl.CurrentY = CurrY - 45
  446.             UserControl.ForeColor = RGB(255, 255, 255)
  447.             UserControl.Print m_Caption
  448.             
  449.             UserControl.CurrentX = CurrX - 30
  450.             UserControl.CurrentY = CurrY - 30
  451.             UserControl.ForeColor = RGB(255, 255, 255)
  452.             UserControl.Print m_Caption
  453.             
  454.             UserControl.CurrentX = CurrX - 15
  455.             UserControl.CurrentY = CurrY - 15
  456.             UserControl.ForeColor = RGB(255, 255, 255)
  457.             UserControl.Print m_Caption
  458.             UserControl.CurrentX = CurrX
  459.             UserControl.CurrentY = CurrY
  460.             UserControl.ForeColor = oldForeColor
  461.             UserControl.Print m_Caption
  462.         
  463.         End Select
  464. ' UNCOMMENT THE FOLLOWING LINES TO DRAW TWO CROSS LINE
  465. ' AT THE CENTER OF THE USERCONTROL OBJECT
  466. ' I used these statements to verify the centering of the caption
  467. '        UserControl.ForeColor = RGB(255, 255, 0)
  468. '        UserControl.Line (0, UserControl.Height / 2)-(UserControl.Width, UserControl.Height / 2)
  469. '        UserControl.Line (UserControl.Width / 2, 0)-(UserControl.Width / 2, UserControl.Height)
  470. End Sub
  471. 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
  472. 'MappingInfo=UserControl,UserControl,-1,BackColor
  473. Public Property Get BackColor() As OLE_COLOR
  474. Attribute BackColor.VB_Description = "Returns/sets the background color used to display text and graphics in an object."
  475.     BackColor = UserControl.BackColor
  476. End Property
  477. Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
  478.     UserControl.BackColor() = New_BackColor
  479.     PropertyChanged "BackColor"
  480.     UserControl_Paint
  481. End Property
  482.