VERSION 5.00
Begin VB.UserControl BorderBut 
   ClientHeight    =   1530
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   2835
   ScaleHeight     =   102
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   189
   Begin VB.CommandButton cmdButton 
      Caption         =   "Command1"
      Height          =   615
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   1455
   End
   Begin VB.Shape BlueBorder 
      BorderColor     =   &H80000002&
      FillColor       =   &H80000002&
      FillStyle       =   0  'Solid
      Height          =   615
      Left            =   0
      Top             =   0
      Width           =   1455
   End
End
Attribute VB_Name = "BorderBut"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
'
'
Private m_BorderWidth As Integer
'

Private Sub cmdButton_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    cmdButton.Top = m_BorderWidth / 2
    cmdButton.Left = m_BorderWidth / 2
    cmdButton.Height = ScaleHeight - m_BorderWidth
    cmdButton.Width = ScaleWidth - m_BorderWidth
End Sub

Private Sub cmdButton_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    cmdButton.Top = 0
    cmdButton.Left = 0
    cmdButton.Height = ScaleHeight
    cmdButton.Width = ScaleWidth
End Sub

Private Sub UserControl_Initialize()
    m_BorderWidth = 10
End Sub

Private Sub UserControl_Resize()
    cmdButton.Height = ScaleHeight
    cmdButton.Width = ScaleWidth
    '
    BlueBorder.Height = ScaleHeight
    BlueBorder.Width = ScaleWidth
End Sub

Public Property Get ColorBorderWidth() As Variant
    ColorBorderWidth = m_BorderWidth
End Property

Public Property Let ColorBorderWidth(ByVal vNewValue As Variant)
    m_BorderWidth = vNewValue
End Property

Public Property Get Color() As OLE_COLOR
    Color = BlueBorder.BackColor
End Property

Public Property Let Color(ByVal vNewValue As OLE_COLOR)
    BlueBorder.BackColor = vNewValue
    BlueBorder.BorderColor = vNewValue
    BlueBorder.FillColor = vNewValue
End Property

'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    '
    BlueBorder.BackColor = PropBag.ReadProperty("Color")
    BlueBorder.BorderColor = BlueBorder.BackColor
    BlueBorder.FillColor = BlueBorder.BackColor
    '
    m_BorderWidth = PropBag.ReadProperty("ColorBorderWidth", 10)
    '
End Sub

'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    '
    Call PropBag.WriteProperty("Color", BlueBorder.BackColor)
    Call PropBag.WriteProperty("ColorBorderWidth", m_BorderWidth, 10)
    '
End Sub
