VERSION 5.00
Begin VB.UserControl SmartButton 
   ClientHeight    =   3600
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   4800
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ScaleHeight     =   240
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   320
   Begin VB.Label lblIntercepter 
      BackStyle       =   0  'Transparent
      Height          =   1320
      Left            =   45
      TabIndex        =   1
      Top             =   45
      Width           =   1995
   End
   Begin VB.Label lblCaption 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "SmartButton"
      Height          =   195
      Left            =   945
      TabIndex        =   0
      Top             =   1935
      Width           =   900
   End
   Begin VB.Shape shpDeco 
      BorderColor     =   &H00B0B0B0&
      Height          =   1095
      Index           =   1
      Left            =   2505
      Shape           =   4  'Rounded Rectangle
      Top             =   1380
      Width           =   1365
   End
   Begin VB.Shape shpDeco 
      BorderColor     =   &H00D0D0D0&
      Height          =   1095
      Index           =   0
      Left            =   2520
      Shape           =   4  'Rounded Rectangle
      Top             =   1395
      Width           =   1365
   End
End
Attribute VB_Name = "SmartButton"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
'Event Declarations:
Event Click() 'MappingInfo=lblIntercepter,lblIntercepter,-1,Click
Attribute Click.VB_Description = "Occurs when the user presses and then releases a mouse button over an object."
Event DblClick() 'MappingInfo=lblIntercepter,lblIntercepter,-1,DblClick
Attribute DblClick.VB_Description = "Occurs when the user presses and releases a mouse button and then presses and releases it again over an object."
Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=lblIntercepter,lblIntercepter,-1,MouseDown
Attribute MouseDown.VB_Description = "Occurs when the user presses the mouse button while an object has the focus."
Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=lblIntercepter,lblIntercepter,-1,MouseMove
Attribute MouseMove.VB_Description = "Occurs when the user moves the mouse."
Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=lblIntercepter,lblIntercepter,-1,MouseUp
Attribute MouseUp.VB_Description = "Occurs when the user releases the mouse button while an object has the focus."
Event MouseIn()
Event MouseOut()


Sub PositionateObjects()

    With UserControl
    .shpDeco(1).Left = 0
    .shpDeco(1).Top = 0
    
    .shpDeco(0).Left = 1
    .shpDeco(0).Top = 1
    
    .shpDeco(1).Width = .ScaleWidth - 1
    .shpDeco(1).Height = .ScaleHeight - 1
    
    .shpDeco(0).Width = .ScaleWidth - 1
    .shpDeco(0).Height = .ScaleHeight - 1
    
    .lblCaption.Left = ((.ScaleWidth - .lblCaption.Width) / 2)
    .lblCaption.Top = ((.ScaleHeight - .lblCaption.Height) / 2)
    
    End With

End Sub

Private Sub lblCaption_Change()
PositionateObjects
End Sub

Private Sub UserControl_Initialize()
SubClass
End Sub
Private Sub UserControl_Resize()
PositionateObjects
End Sub


'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=UserControl,UserControl,-1,BackColor
Public Property Get BackColor() As OLE_COLOR
Attribute BackColor.VB_Description = "Returns/sets the background color used to display text and graphics in an object."
    BackColor = UserControl.BackColor
End Property

Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
    UserControl.BackColor() = New_BackColor
    PropertyChanged "BackColor"
End Property
'
''WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
''MappingInfo=shpDeco(0),shpDeco,0,BorderWidth
'Public Property Get BorderWidth() As Integer
'    BorderWidth = shpDeco(0).BorderWidth
'End Property
'
'Public Property Let BorderWidth(ByVal New_BorderWidth As Integer)
'    shpDeco(0).BorderWidth() = New_BorderWidth
'    PropertyChanged "BorderWidth"
'End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=lblCaption,lblCaption,-1,Caption
Public Property Get Caption() As String
Attribute Caption.VB_Description = "Returns/sets the text displayed in an object's title bar or below an object's icon."
    Caption = lblCaption.Caption
End Property

Public Property Let Caption(ByVal New_Caption As String)
    lblCaption.Caption() = New_Caption
    PropertyChanged "Caption"
End Property

Private Sub lblIntercepter_Click()
    RaiseEvent Click
End Sub

Private Sub lblIntercepter_DblClick()
    RaiseEvent DblClick
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=lblCaption,lblCaption,-1,Font
Public Property Get Font() As Font
Attribute Font.VB_Description = "Returns a Font object."
Attribute Font.VB_UserMemId = -512
    Set Font = lblCaption.Font
End Property

Public Property Set Font(ByVal New_Font As Font)
    Set lblCaption.Font = New_Font
    PropertyChanged "Font"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=lblCaption,lblCaption,-1,ForeColor
Public Property Get ForeColor() As OLE_COLOR
Attribute ForeColor.VB_Description = "Returns/sets the foreground color used to display text and graphics in an object."
    ForeColor = lblCaption.ForeColor
End Property

Public Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR)
    lblCaption.ForeColor() = New_ForeColor
    PropertyChanged "ForeColor"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=UserControl,UserControl,-1,hWnd
Public Property Get hwnd() As Long
Attribute hwnd.VB_Description = "Returns a handle (from Microsoft Windows) to an object's window."
    hwnd = UserControl.hwnd
End Property

Private Sub lblIntercepter_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseDown(Button, Shift, X, Y)
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=lblIntercepter,lblIntercepter,-1,MouseIcon
Public Property Get MouseIcon() As Picture
Attribute MouseIcon.VB_Description = "Sets a custom mouse icon."
    Set MouseIcon = lblIntercepter.MouseIcon
End Property

Public Property Set MouseIcon(ByVal New_MouseIcon As Picture)
    Set lblIntercepter.MouseIcon = New_MouseIcon
    PropertyChanged "MouseIcon"
End Property

Private Sub lblIntercepter_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseMove(Button, Shift, X, Y)
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=lblIntercepter,lblIntercepter,-1,MousePointer
Public Property Get MousePointer() As Integer
Attribute MousePointer.VB_Description = "Returns/sets the type of mouse pointer displayed when over part of an object."
    MousePointer = lblIntercepter.MousePointer
End Property

Public Property Let MousePointer(ByVal New_MousePointer As Integer)
    lblIntercepter.MousePointer() = New_MousePointer
    PropertyChanged "MousePointer"
End Property

Private Sub lblIntercepter_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseUp(Button, Shift, X, Y)
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=UserControl,UserControl,-1,BackColor
Public Property Get BackColorOnMouseOver() As OLE_COLOR
Attribute BackColorOnMouseOver.VB_Description = "Returns/sets the background color used to display text and graphics in an object."
    BackColorOnMouseOver = UserControl.BackColor
End Property

Public Property Let BackColorOnMouseOver(ByVal New_BackColorOnMouseOver As OLE_COLOR)
    UserControl.BackColor() = New_BackColorOnMouseOver
    PropertyChanged "BackColorOnMouseOver"
End Property

'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

    UserControl.BackColor = PropBag.ReadProperty("BackColor", &H8000000F)
    shpDeco(0).BorderWidth = PropBag.ReadProperty("BorderWidth", 1)
    lblCaption.Caption = PropBag.ReadProperty("Caption", "SmartButton")
    Set lblCaption.Font = PropBag.ReadProperty("Font", Ambient.Font)
    lblCaption.ForeColor = PropBag.ReadProperty("ForeColor", &H80000012)
    Set MouseIcon = PropBag.ReadProperty("MouseIcon", Nothing)
    lblIntercepter.MousePointer = PropBag.ReadProperty("MousePointer", 0)
    UserControl.BackColor = PropBag.ReadProperty("BackColorOnMouseOver", &H8000000F)
    shpDeco(0).BorderWidth = PropBag.ReadProperty("BorderWidth", 1)
    shpDeco(1).BorderColor = PropBag.ReadProperty("BorderDark", &HB0B0B0)
    shpDeco(0).BorderColor = PropBag.ReadProperty("BorderLight", &HD0D0D0)
End Sub
Private Sub UserControl_Terminate()
UnSubClass
End Sub
'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

    Call PropBag.WriteProperty("BackColor", UserControl.BackColor, &H8000000F)
    Call PropBag.WriteProperty("BorderWidth", shpDeco(0).BorderWidth, 1)
    Call PropBag.WriteProperty("Caption", lblCaption.Caption, "SmartButton")
    Call PropBag.WriteProperty("Font", lblCaption.Font, Ambient.Font)
    Call PropBag.WriteProperty("ForeColor", lblCaption.ForeColor, &H80000012)
    Call PropBag.WriteProperty("MouseIcon", MouseIcon, Nothing)
    Call PropBag.WriteProperty("MousePointer", lblIntercepter.MousePointer, 0)
    Call PropBag.WriteProperty("BackColorOnMouseOver", UserControl.BackColor, &H8000000F)
    Call PropBag.WriteProperty("BorderWidth", shpDeco(0).BorderWidth, 1)
    Call PropBag.WriteProperty("BorderDark", shpDeco(1).BorderColor, &HB0B0B0)
    Call PropBag.WriteProperty("BorderLight", shpDeco(0).BorderColor, &HD0D0D0)
End Sub
'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=shpDeco(0),shpDeco,0,BorderWidth
Public Property Get BorderWidth() As Integer
Attribute BorderWidth.VB_Description = "Returns or sets the width of a control's border."
    BorderWidth = shpDeco(0).BorderWidth
End Property

Public Property Let BorderWidth(ByVal New_BorderWidth As Integer)
    shpDeco(0).BorderWidth() = New_BorderWidth
    PropertyChanged "BorderWidth"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=shpDeco(1),shpDeco,1,BorderColor
Public Property Get BorderDark() As OLE_COLOR
Attribute BorderDark.VB_Description = "Returns/sets the color of an object's border."
    BorderDark = shpDeco(1).BorderColor
End Property
Public Property Let BorderDark(ByVal New_BorderDark As OLE_COLOR)
    shpDeco(1).BorderColor() = New_BorderDark
    PropertyChanged "BorderDark"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=shpDeco(0),shpDeco,0,BorderColor
Public Property Get BorderLight() As OLE_COLOR
Attribute BorderLight.VB_Description = "Returns/sets the color of an object's border."
    BorderLight = shpDeco(0).BorderColor
End Property

Public Property Let BorderLight(ByVal New_BorderLight As OLE_COLOR)
    shpDeco(0).BorderColor() = New_BorderLight
    PropertyChanged "BorderLight"
End Property

