home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD124071262000.psc / AOLCmd.ctl (.txt) next >
Encoding:
Visual Basic Form  |  2000-11-14  |  24.0 KB  |  611 lines

  1. VERSION 5.00
  2. Begin VB.UserControl AOLCmd 
  3.    ClientHeight    =   1320
  4.    ClientLeft      =   0
  5.    ClientTop       =   0
  6.    ClientWidth     =   2370
  7.    MouseIcon       =   "AOLCmd.ctx":0000
  8.    ScaleHeight     =   1320
  9.    ScaleWidth      =   2370
  10.    ToolboxBitmap   =   "AOLCmd.ctx":0152
  11.    Begin VB.PictureBox Picture2 
  12.       AutoRedraw      =   -1  'True
  13.       AutoSize        =   -1  'True
  14.       BackColor       =   &H8000000B&
  15.       BorderStyle     =   0  'None
  16.       Height          =   375
  17.       Left            =   120
  18.       ScaleHeight     =   375
  19.       ScaleWidth      =   1095
  20.       TabIndex        =   1
  21.       Top             =   720
  22.       Visible         =   0   'False
  23.       Width           =   1095
  24.    End
  25.    Begin VB.PictureBox Picture1 
  26.       AutoRedraw      =   -1  'True
  27.       BackColor       =   &H8000000B&
  28.       BorderStyle     =   0  'None
  29.       Height          =   495
  30.       Left            =   0
  31.       MouseIcon       =   "AOLCmd.ctx":0464
  32.       MousePointer    =   99  'Custom
  33.       ScaleHeight     =   495
  34.       ScaleWidth      =   1095
  35.       TabIndex        =   0
  36.       Top             =   0
  37.       Width           =   1095
  38.    End
  39. Attribute VB_Name = "AOLCmd"
  40. Attribute VB_GlobalNameSpace = False
  41. Attribute VB_Creatable = True
  42. Attribute VB_PredeclaredId = False
  43. Attribute VB_Exposed = False
  44. '###########################################
  45. '# Info                                    #
  46. '#                                         #
  47. '# Creator: ChiChis                        #
  48. '# Date: Feb. 19, 2000                     #
  49. '# Made with help/example from: N/A        #
  50. '###########################################
  51. '# Description                             #
  52. '#                                         #
  53. '# This is a very customizable AOL button  #
  54. '# replication.  If you leave it to        #
  55. '# StandardColors it looks EXACTLY and I   #
  56. '# mean exactly like real AOL buttons.     #
  57. '# But, if you would like ot play around   #
  58. '# you can do so.  It also supports images #
  59. '# on the buttons.                         #
  60. '###########################################
  61. '# How To Use                              #
  62. '#                                         #
  63. '# It's like a regular command button,     #
  64. '# just looks like AOL buttons.  If you    #
  65. '# want to compile this into a program you #
  66. '# must set the Public property to false   #
  67. '# of else you will get an error.  If you  #
  68. '# would like to change the color, you     #
  69. '# must set 'StandardColors' to false or   #
  70. '# it will not let you change them.        #
  71. '###########################################
  72. '# More Info                               #
  73. '# http://paa.11net.com                    #
  74. '###########################################
  75. 'API Calls
  76. Private Declare Function ReleaseCapture Lib "user32" () As Long
  77. Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
  78. Private Declare Function GetCapture Lib "user32" () As Long
  79. Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
  80. Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
  81. Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
  82. 'Constant for drawing the image
  83. Private Const SRCCOPY = &HCC0020
  84. 'The events users of this control will have.
  85. 'MouseEnter and MouseLeave new to Version2.
  86. Public Event Click()
  87. Public Event DblClick()
  88. Public Event KeyDown(KeyCode As Integer, Shift As Integer)
  89. Public Event KeyPress(KeyAscii As Integer)
  90. Public Event KeyUp(KeyCode As Integer, Shift As Integer)
  91. Public Event MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  92. Public Event MouseEnter(Button As Integer, Shift As Integer, x As Single, y As Single)
  93. Public Event MouseLeave(Button As Integer, Shift As Integer, x As Single, y As Single)
  94. Public Event MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  95. Public Event MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  96. 'These allow us ot have ComboBoxes in the properties
  97. Enum TheStyle
  98.     StyleOne
  99.     StyleTwo
  100. End Enum
  101. Enum TheAutoSize
  102.     NoAutoSize
  103.     ButtonToPic
  104.     PicToButton
  105. End Enum
  106. 'This is for storing the font
  107. Private WithEvents TheFont As StdFont
  108. Attribute TheFont.VB_VarHelpID = -1
  109. 'These are our storing variables, most store property values
  110. Dim TheCaption As String, TheStyleX As TheStyle, HasFocus As Boolean
  111. Dim MouseDowned As Boolean, TheEnabled As Boolean, TheGraphical As Boolean
  112. Dim TheAutoSizeX As TheAutoSize, TheForeColor As OLE_COLOR, TheBackColor As OLE_COLOR
  113. Dim TheStandardColors As Boolean, TheBorderLight As OLE_COLOR, TheBorderDark As OLE_COLOR
  114. Dim TheBackColorClick As OLE_COLOR, TheX As Single, TheY As Single
  115. Dim TheButton As Integer, TheShift As Integer, OldWndProc As Long
  116. Private Sub DrawButton(Offset As Long, Clicked As Boolean)
  117.     'This is where the drawing of the button occurs.
  118.     'Everything is in here.  offset is so we can draw
  119.     'the button down, and Clicked is so we know when
  120.     'we are drawing the clicked state.
  121.     Dim ClickColor As Long, SetWidth As Long, SetHeight As Long
  122.     Dim SetLeft As Long, SetTop As Long, i As Long
  123.     Dim x As Long, y As Long, Checker As Boolean
  124.     'Clear our button so there are no remnants when we redraw it
  125.     Picture1.Cls
  126.     'Fill in the small space on the bottom left and bottom right
  127.     'where we don't draw with the parent's color
  128.     Picture1.BackColor = Ambient.BackColor
  129.     'Draw the outline of the main part of the button
  130.     Picture1.Line (Offset + 0, Offset + 0)-(Offset + 0, Offset + Picture1.Height - 60), BorderLight
  131.     Picture1.Line (Offset + 0, Offset + 0)-(Offset + Picture1.Width - 60, Offset + 0), BorderLight
  132.     Picture1.Line (Offset + 0, Offset + Picture1.Height - 60)-(Offset + Picture1.Width - 60, Offset + Picture1.Height - 60), BorderDark
  133.     Picture1.Line (Offset + Picture1.Width - 60, Offset + 0)-(Offset + Picture1.Width - 60, Offset + Picture1.Height - 45), BorderDark
  134.     'Draw the main area of the button
  135.     If Clicked = True Then
  136.         Picture1.Line (Offset + 15, Offset + 15)-(Offset + Picture1.Width - 75, Offset + Picture1.Height - 75), TheBackColorClick, BF
  137.     Else
  138.         Picture1.Line (Offset + 15, Offset + 15)-(Offset + Picture1.Width - 75, Offset + Picture1.Height - 75), TheBackColor, BF
  139.     End If
  140.     'Draw the 3 tiered shadow
  141.     Picture1.Line (Offset + 75, Offset + Picture1.Height - 45)-(Offset + Picture1.Width - 30, Offset + Picture1.Height - 45), 8421504
  142.     Picture1.Line (Offset + Picture1.Width - 45, Offset + 75)-(Offset + Picture1.Width - 45, Offset + Picture1.Height - 45), 8421504
  143.     Picture1.Line (Offset + 75, Offset + Picture1.Height - 30)-(Offset + Picture1.Width - 30, Offset + Picture1.Height - 30), 10526880
  144.     Picture1.Line (Offset + Picture1.Width - 30, Offset + 75)-(Offset + Picture1.Width - 30, Offset + Picture1.Height - 15), 10526880
  145.     Picture1.Line (Offset + 75, Offset + Picture1.Height - 15)-(Offset + Picture1.Width - 15, Offset + Picture1.Height - 15), 12632256
  146.     Picture1.Line (Offset + Picture1.Width - 15, Offset + 75)-(Offset + Picture1.Width - 15, Offset + Picture1.Height), 12632256
  147.     'We need to draw the picture onto the button
  148.     If TheGraphical = True Then
  149.         'Don't draw unless there is a picture
  150.         If Not Picture2.Picture = 0 Then
  151.             'If the user wants the image stretched, we need to account for that
  152.             If AutoSize = PicToButton Then
  153.                 'We get the width and the height of where it needs to be drawn
  154.                 SetWidth = (UserControl.Width - 75) / 15
  155.                 SetHeight = (UserControl.Height - 75) / 15
  156.                 'Draw it using the SreetchBlt call so we can resize it
  157.                 StretchBlt Picture1.hdc, 1 + Offset / 15, 1 + Offset / 15, SetWidth, SetHeight, Picture2.hdc, 0, 0, Picture2.Width / 15, Picture2.Height / 15, SRCCOPY
  158.             Else
  159.                 'Get all the coordinates now so drawing is easier
  160.                 SetWidth = Picture2.Width / 15
  161.                 SetHeight = Picture2.Height / 15
  162.                 SetLeft = (UserControl.Width / 2 - Picture2.Width / 2 - 22) / 15 + Offset / 15
  163.                 SetTop = (UserControl.Height / 2 - Picture2.Height / 2 - 22) / 15 + Offset / 15
  164.                 'Check to see if the picture is bigger than our drawing surface.
  165.                 'If it is, we will need to clip parts off it
  166.                 If Picture2.Width > UserControl.Width - 75 Then
  167.                     SetWidth = (UserControl.Width - 75) / 15
  168.                     SetLeft = 1
  169.                 End If
  170.                 If Picture2.Height > UserControl.Height - 75 Then
  171.                     SetHeight = (UserControl.Height - 75) / 15
  172.                     SetTop = 1
  173.                 End If
  174.                 'Draw the picture
  175.                 BitBlt Picture1.hdc, SetLeft, SetTop, SetWidth, SetHeight, Picture2.hdc, 0, 0, SRCCOPY
  176.             End If
  177.         End If
  178.     End If
  179.     'This is where we draw the text.  First we find the exact place to draw it from
  180.     Picture1.CurrentX = (Picture1.Width - Picture1.TextWidth(TheCaption)) / 2 - 22 + Offset
  181.     Picture1.CurrentY = (Picture1.Height - Picture1.TextHeight(TheCaption)) / 2 - 22 + Offset
  182.     'Set the color right
  183.     Picture1.ForeColor = TheForeColor
  184.     'And then wed draw it
  185.     Picture1.Print TheCaption
  186.     'This is where we draw the focus rectnagle
  187.     If HasFocus = True Then
  188.         'Check to see if we draw it clicked
  189.         If Clicked = True Then
  190.             'If the backcolor changes on click...
  191.             If Not BackColor = BackColorClick Then
  192.                 'We change the DrawMode to 'Inverse'.  On closer
  193.                 'Inspection of AOL's button, the Focus Rectangle
  194.                 'changes color when clicked on IMs.  I found out
  195.                 'through trial and error that DrawMode 6 matches
  196.                 'exactly the color.
  197.                 Picture1.DrawMode = 6
  198.             End If
  199.         End If
  200.         'Here is where we draw it.  Use step 30 to skip every
  201.         'other pixel and then use PSet to draw the pixel.
  202.         For i = 60 To Picture1.Width - 105 Step 30
  203.             Picture1.PSet (i + Offset, 45 + Offset), 5608190
  204.         Next
  205.         For i = 60 To Picture1.Width - 120 Step 30
  206.             Picture1.PSet (i + Offset, Picture1.Height - 105 + Offset), 5608190
  207.         Next
  208.         For i = 60 To Picture1.Height - 105 Step 30
  209.             Picture1.PSet (45 + Offset, i + Offset), 5608190
  210.         Next
  211.         For i = 60 To Picture1.Height - 105 Step 30
  212.             Picture1.PSet (Picture1.Width - 105 + Offset, i + Offset), 5608190
  213.         Next
  214.         'Set the DrawMode back to what it normally is
  215.         Picture1.DrawMode = 13
  216.     End If
  217.     'If it is Disabled we need to draw a mask over it.
  218.     'This mas is just a checkerboard of white pixels.
  219.     'We use nested For...Next loops to accomplish this.
  220.     If TheEnabled = False Then
  221.         For x = 0 To Picture1.Width - 75 Step 15
  222.             'Every other time we have it start one
  223.             'pixel lower so achieve the checkboard effect.
  224.             'We use 'Checker' to hold if it's time
  225.             'to do this.
  226.             If Checker = False Then
  227.                 For y = 0 To Picture1.Height - 75 Step 30
  228.                     Picture1.PSet (x, y), &HFFFFFF
  229.                 Next
  230.                 Checker = True
  231.             Else
  232.                 For y = 15 To Picture1.Height - 75 Step 30
  233.                     Picture1.PSet (x, y), &HFFFFFF
  234.                 Next
  235.                 Checker = False
  236.             End If
  237.         Next
  238.     End If
  239. End Sub
  240. Private Sub Picture1_Click()
  241.     'Pass the click event only if it has the focus
  242.     If HasFocus = True Then
  243.         RaiseEvent Click
  244.     End If
  245. End Sub
  246. Private Sub Picture1_DblClick()
  247.     'Pass double click event
  248.     RaiseEvent DblClick
  249. End Sub
  250. Private Sub Picture1_GotFocus()
  251.     'Set our focus holding variable to True
  252.     HasFocus = True
  253.     'Redraw the button accordingly
  254.     If MouseDowned = True Then
  255.         If Style = StyleOne Then
  256.             DrawButton 45, True
  257.         Else
  258.             DrawButton 0, True
  259.         End If
  260.     Else
  261.         DrawButton 0, False
  262.     End If
  263. End Sub
  264. Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer)
  265.     'Pass KewDown event
  266.     RaiseEvent KeyDown(KeyCode, Shift)
  267. End Sub
  268. Private Sub Picture1_KeyPress(KeyAscii As Integer)
  269.     'Pass KeyPress event
  270.     RaiseEvent KeyPress(KeyAscii)
  271. End Sub
  272. Private Sub Picture1_KeyUp(KeyCode As Integer, Shift As Integer)
  273.     'Pass KeyUp event
  274.     RaiseEvent KeyUp(KeyCode, Shift)
  275. End Sub
  276. Private Sub Picture1_LostFocus()
  277.     'Reset everything to non-focused state
  278.     HasFocus = False
  279.     MouseDowned = False
  280.     DrawButton 0, False
  281. End Sub
  282. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  283.     'If the mouse is clicked
  284.     If Button = 1 Then
  285.         'Captue the picture so we can
  286.         'monitor when the mosue leaves
  287.         SetCapture Picture1.hwnd
  288.         MouseDowned = True
  289.         'If it has the focus (which is should)
  290.         'draw the button in it's new state
  291.         If HasFocus = True Then
  292.             If Style = StyleOne Then
  293.                 DrawButton 45, True
  294.             Else
  295.                 DrawButton 0, True
  296.             End If
  297.         End If
  298.     End If
  299.     'Pass MouseDown event
  300.     RaiseEvent MouseDown(Button, Shift, x, y)
  301. End Sub
  302. Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  303.     'If our button is not already captured
  304.     If GetCapture <> Picture1.hwnd Then
  305.         'Raise MouseEnter because the mouse just entered
  306.         RaiseEvent MouseEnter(Button, Shift, x, y)
  307.         'If the mouse is down
  308.         If Button = 1 Then
  309.             'If it has the focus
  310.             If HasFocus = True Then
  311.                 'Capture the button so we know when it leaves
  312.                 SetCapture Picture1.hwnd
  313.                 'Draw button correct way
  314.                 If Style = StyleOne Then
  315.                     DrawButton 45, True
  316.                 Else
  317.                     DrawButton 0, True
  318.                 End If
  319.             End If
  320.         End If
  321.     End If
  322.     'If the mouse is outside the button
  323.     If x < 0 Or x > Picture1.ScaleWidth Or y < 0 Or y > Picture1.ScaleHeight Then
  324.         'If our button is captured
  325.         If GetCapture = Picture1.hwnd Then
  326.             'Release the capture
  327.             ReleaseCapture
  328.             'THe Mouse Left, raise the event
  329.             RaiseEvent MouseLeave(Button, Shift, x, y)
  330.             'Redraw the button
  331.             DrawButton 0, False
  332.         End If
  333.     End If
  334.     'Pass MouseMove event
  335.     RaiseEvent MouseMove(Button, Shift, x, y)
  336. End Sub
  337. Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  338.     'If if it was the left mouse button
  339.     If Button = 1 Then
  340.         'We Recapture the button for safety
  341.         SetCapture Picture1.hwnd
  342.         'Reset our stuff
  343.         MouseDowned = False
  344.         DrawButton 0, False
  345.     End If
  346.     'Pass MouseUp event
  347.     RaiseEvent MouseUp(Button, Shift, x, y)
  348. End Sub
  349. Private Sub UserControl_AmbientChanged(PropertyName As String)
  350.     'If the BackColor changes of the form
  351.     If PropertyName = "BackColor" Then
  352.         'Redraw the button to fill in new color
  353.         DrawButton 0, False
  354.     End If
  355. End Sub
  356. Private Sub UserControl_InitProperties()
  357.     'Set some of the properties to their initial values
  358.     Set TheFont = New StdFont
  359.     TheFont.Name = "Tahoma"
  360.     Set Font = TheFont
  361.     Caption = Extender.Name
  362.     Enabled = True
  363.     ForeColor = &HFFFFFF
  364.     BackColor = &HAA6D00
  365.     StandardColors = True
  366.     BorderLight = &HFFB691
  367.     BorderDark = &HFFB691
  368.     BackColorClick = &HAA6D00
  369. End Sub
  370. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  371.     'Load our properties when we need to
  372.     Caption = PropBag.ReadProperty("Caption", Extender.Name)
  373.     Style = PropBag.ReadProperty("Style", StyleOne)
  374.     Set Font = PropBag.ReadProperty("Font")
  375.     Enabled = PropBag.ReadProperty("Enabled", True)
  376.     Set Picture = PropBag.ReadProperty("Picture")
  377.     Graphical = PropBag.ReadProperty("Graphical", False)
  378.     AutoSize = PropBag.ReadProperty("AutoSize", NoAutoSize)
  379.     ForeColor = PropBag.ReadProperty("ForeColor", &HFFFFFF)
  380.     BackColor = PropBag.ReadProperty("BackColor", 11169024)
  381.     StandardColors = PropBag.ReadProperty("StandardColors", True)
  382.     BorderLight = PropBag.ReadProperty("BorderLight", &HFFB691)
  383.     BorderDark = PropBag.ReadProperty("BorderDark", &HFFB691)
  384.     BackColorClick = PropBag.ReadProperty("BackColorClick", &HAA6D00)
  385. End Sub
  386. Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
  387.     'Save our properties when we need to
  388.     PropBag.WriteProperty "Caption", Caption, Extender.Name
  389.     PropBag.WriteProperty "Style", Style, StyleOne
  390.     PropBag.WriteProperty "Font", Font
  391.     PropBag.WriteProperty "Enabled", Enabled, True
  392.     PropBag.WriteProperty "Picture", Picture
  393.     PropBag.WriteProperty "Graphical", Graphical, False
  394.     PropBag.WriteProperty "AutoSize", AutoSize, NoAutoSize
  395.     PropBag.WriteProperty "ForeColor", ForeColor, &HFFFFFF
  396.     PropBag.WriteProperty "BackColor", BackColor, 11169024
  397.     PropBag.WriteProperty "StandardColors", StandardColors, True
  398.     PropBag.WriteProperty "BorderLight", BorderLight, &HFFB691
  399.     PropBag.WriteProperty "BorderDark", BorderDark, &HFFB691
  400.     PropBag.WriteProperty "BackColorClick", BackColorClick, &HAA6D00
  401. End Sub
  402. Private Sub UserControl_Resize()
  403.     'Make sure it is at least a certain size
  404.     If UserControl.Width < 300 Or UserControl.Height < 300 Then
  405.         Size 300, 300
  406.         Exit Sub
  407.     End If
  408.     'Make sure the picture is always as big as the button
  409.     Picture1.Width = UserControl.Width
  410.     Picture1.Height = UserControl.Height
  411.     'If it is graphical
  412.     If Graphical = True Then
  413.         'If the button should be as big as the pic
  414.         If TheAutoSizeX = ButtonToPic Then
  415.             'Resize the button to right size
  416.             If Picture2.Width > 120 And Picture2.Height > 120 Then
  417.                 UserControl.Height = Picture2.Height + 75
  418.                 UserControl.Width = Picture2.Width + 75
  419.             End If
  420.         End If
  421.     End If
  422.     'Redraw button
  423.     DrawButton 0, False
  424. End Sub
  425. Public Property Get Caption() As String
  426.     'Get the capture
  427.     Caption = TheCaption
  428. End Property
  429. Public Property Let Caption(ByVal NewCaption As String)
  430.     'Set caption and redraw
  431.     TheCaption = NewCaption
  432.     UserControl_Resize
  433.     PropertyChanged "Caption"
  434. End Property
  435. Public Property Get Style() As TheStyle
  436.     'Get style
  437.     Style = TheStyleX
  438. End Property
  439. Public Property Let Style(ByVal NewStyle As TheStyle)
  440.     'We might need to change some colors here
  441.     'if StandardColors is true.  Redraw afterward
  442.     TheStyleX = NewStyle
  443.     If TheStandardColors = True Then
  444.         If TheStyleX = StyleTwo Then
  445.             TheBorderDark = &H0
  446.             TheBackColorClick = &H8000000D
  447.         Else
  448.             TheBorderDark = &HFFB691
  449.             TheBackColorClick = &HAA6D00
  450.         End If
  451.     End If
  452.     UserControl_Resize
  453.     PropertyChanged "Style"
  454. End Property
  455. Public Property Get Font() As StdFont
  456.     'Get font
  457.     Set Font = TheFont
  458. End Property
  459. Public Property Set Font(NewFont As StdFont)
  460.     'Set font and redraw button
  461.     Set TheFont = NewFont
  462.     Set Picture1.Font = NewFont
  463.     DrawButton 0, False
  464.     PropertyChanged "Font"
  465. End Property
  466. Public Property Get Enabled() As Boolean
  467.     'Get Enabled
  468.     Enabled = TheEnabled
  469. End Property
  470. Public Property Let Enabled(ByVal NewValue As Boolean)
  471.     'Set enabled and redraw
  472.     TheEnabled = NewValue
  473.     If Enabled = True Then
  474.         UserControl.Enabled = True
  475.     Else
  476.         UserControl.Enabled = False
  477.         ReleaseCapture
  478.     End If
  479.     DrawButton 0, False
  480.     PropertyChanged "Enabled"
  481. End Property
  482. Public Property Get Picture() As Picture
  483.     'Get picture
  484.     Set Picture = Picture2.Picture
  485. End Property
  486. Public Property Set Picture(ByVal NewPicture As Picture)
  487.     'Set picture and redraw
  488.     Set Picture2.Picture = NewPicture
  489.     UserControl_Resize
  490.     PropertyChanged "Picture"
  491. End Property
  492. Public Property Get Graphical() As Boolean
  493.     'Get graphical
  494.     Graphical = TheGraphical
  495. End Property
  496. Public Property Let Graphical(ByVal NewValue As Boolean)
  497.     'Change graphical and redraw
  498.     TheGraphical = NewValue
  499.     UserControl_Resize
  500.     PropertyChanged "Graphical"
  501. End Property
  502. Public Property Get AutoSize() As TheAutoSize
  503.     'Get AutoSize
  504.     AutoSize = TheAutoSizeX
  505. End Property
  506. Public Property Let AutoSize(ByVal NewValue As TheAutoSize)
  507.     'Change AutoSize and redraw
  508.     TheAutoSizeX = NewValue
  509.     UserControl_Resize
  510.     PropertyChanged "AutoSize"
  511. End Property
  512. Public Property Get ForeColor() As OLE_COLOR
  513.     'Get ForeColor
  514.     ForeColor = TheForeColor
  515. End Property
  516. Public Property Let ForeColor(ByVal NewColor As OLE_COLOR)
  517.     'Change ForeColor and StandardColors is false
  518.     If TheStandardColors = True Then
  519.         TheForeColor = &HFFFFFF
  520.         Exit Property
  521.     End If
  522.     TheForeColor = NewColor
  523.     DrawButton 0, False
  524.     PropertyChanged "ForeColor"
  525. End Property
  526. Public Property Get BackColor() As OLE_COLOR
  527.     'Get BackColor
  528.     BackColor = TheBackColor
  529. End Property
  530. Public Property Let BackColor(ByVal NewColor As OLE_COLOR)
  531.     'Change BackColor is we can
  532.     If TheStandardColors = True Then
  533.         TheBackColor = &HAA6D00
  534.         Exit Property
  535.     End If
  536.     TheBackColor = NewColor
  537.     DrawButton 0, False
  538.     PropertyChanged "BackColor"
  539. End Property
  540. Public Property Get StandardColors() As Boolean
  541.     'Get StandardColors
  542.     StandardColors = TheStandardColors
  543. End Property
  544. Public Property Let StandardColors(ByVal NewValue As Boolean)
  545.     'Change other properties if needed and redraw
  546.     TheStandardColors = NewValue
  547.     If NewValue = True Then
  548.         BackColor = &HAA6D00
  549.         ForeColor = &HFFFFFF
  550.         BorderLight = &HFFB691
  551.         If TheStyleX = StyleTwo Then
  552.             BorderDark = &H0
  553.             BackColorClick = &H8000000D
  554.         Else
  555.             BorderDark = &HFFB691
  556.             BackColorClick = &HAA6D00
  557.         End If
  558.     End If
  559.     DrawButton 0, False
  560.     PropertyChanged "StandardColors"
  561. End Property
  562. Public Property Get BorderLight() As OLE_COLOR
  563.     'Get BorderLight
  564.     BorderLight = TheBorderLight
  565. End Property
  566. Public Property Let BorderLight(ByVal NewColor As OLE_COLOR)
  567.     'Change BorderLight if we can
  568.     If TheStandardColors = True Then
  569.         TheBorderLight = &HFFB691
  570.         Exit Property
  571.     End If
  572.     TheBorderLight = NewColor
  573.     DrawButton 0, False
  574.     PropertyChanged "BorderLight"
  575. End Property
  576. Public Property Get BorderDark() As OLE_COLOR
  577.     'Get BorderDark
  578.     BorderDark = TheBorderDark
  579. End Property
  580. Public Property Let BorderDark(ByVal NewColor As OLE_COLOR)
  581.     'Change BorderDark if we can
  582.     If TheStandardColors = True Then
  583.         If TheStyleX = StyleTwo Then
  584.             TheBorderDark = &H0
  585.         Else
  586.             TheBorderDark = &HFFB691
  587.         End If
  588.         Exit Property
  589.     End If
  590.     TheBorderDark = NewColor
  591.     DrawButton 0, False
  592.     PropertyChanged "BorderDark"
  593. End Property
  594. Public Property Get BackColorClick() As OLE_COLOR
  595.     'Get BackColorClick
  596.     BackColorClick = TheBackColorClick
  597. End Property
  598. Public Property Let BackColorClick(ByVal NewColor As OLE_COLOR)
  599.     'Change BackColorClick if we can
  600.     If TheStandardColors = True Then
  601.         If TheStyleX = StyleTwo Then
  602.             TheBackColorClick = &H8000000D
  603.         Else
  604.             TheBackColorClick = &HAA6D00
  605.         End If
  606.         Exit Property
  607.     End If
  608.     TheBackColorClick = NewColor
  609.     PropertyChanged "BackColorClick"
  610. End Property
  611.