VERSION 5.00
Begin VB.UserControl LightLine 
   Alignable       =   -1  'True
   ClientHeight    =   1065
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   2985
   ScaleHeight     =   71
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   199
   Begin VB.Line Line1 
      BorderColor     =   &H00A0A0A0&
      X1              =   0
      X2              =   129
      Y1              =   0
      Y2              =   6
   End
   Begin VB.Line Line2 
      BorderColor     =   &H00D0D0D0&
      X1              =   15
      X2              =   141
      Y1              =   30
      Y2              =   42
   End
End
Attribute VB_Name = "LightLine"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
'Default Property Values:
Const m_def_LineStyle = 0
'Property Variables:
Dim m_LineStyle As Byte
'Event Declarations:
Event Click() 'MappingInfo=UserControl,UserControl,-1,Click
Attribute Click.VB_Description = "Occurs when the user presses and then releases a mouse button over an object."
Event DblClick() 'MappingInfo=UserControl,UserControl,-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=UserControl,UserControl,-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=UserControl,UserControl,-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=UserControl,UserControl,-1,MouseUp
Attribute MouseUp.VB_Description = "Occurs when the user releases the mouse button while an object has the focus."

    Public Enum ELineStyle
    Horizontal = 0
    Vertical = 1
    End Enum

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=UserControl,UserControl,-1,BorderStyle
Public Property Get BorderStyle() As Integer
Attribute BorderStyle.VB_Description = "Returns/sets the border style for an object."
    BorderStyle = UserControl.BorderStyle
End Property

Public Property Let BorderStyle(ByVal New_BorderStyle As Integer)
    UserControl.BorderStyle() = New_BorderStyle
    PropertyChanged "BorderStyle"
End Property

Private Sub UserControl_Click()
    RaiseEvent Click
End Sub

Private Sub UserControl_DblClick()
    RaiseEvent DblClick
End Sub

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=UserControl,UserControl,-1,hDC
Public Property Get hDC() As Long
Attribute hDC.VB_Description = "Returns a handle (from Microsoft Windows) to the object's device context."
    hDC = UserControl.hDC
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 UserControl_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=UserControl,UserControl,-1,MouseIcon
Public Property Get MouseIcon() As Picture
Attribute MouseIcon.VB_Description = "Sets a custom mouse icon."
    Set MouseIcon = UserControl.MouseIcon
End Property

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

Private Sub UserControl_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=UserControl,UserControl,-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 = UserControl.MousePointer
End Property

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

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

Public Property Get LineStyle() As ELineStyle
    LineStyle = m_LineStyle
End Property

Public Property Let LineStyle(ByVal New_LineStyle As ELineStyle)
    m_LineStyle = New_LineStyle
    UserControl_Resize
    PropertyChanged "LineStyle"
End Property

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

Public Property Let FGColor(ByVal New_FGColor As OLE_COLOR)
    Line2.BorderColor() = New_FGColor
    PropertyChanged "FGColor"
End Property

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

Public Property Let BGColor(ByVal New_BGColor As OLE_COLOR)
    Line1.BorderColor() = New_BGColor
    PropertyChanged "BGColor"
End Property

'Initialize Properties for User Control
Private Sub UserControl_InitProperties()
    m_LineStyle = m_def_LineStyle
End Sub

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

    UserControl.BorderStyle = PropBag.ReadProperty("BorderStyle", 0)
    Set MouseIcon = PropBag.ReadProperty("MouseIcon", Nothing)
    UserControl.MousePointer = PropBag.ReadProperty("MousePointer", 0)
    m_LineStyle = PropBag.ReadProperty("LineStyle", m_def_LineStyle)
    Line2.BorderColor = PropBag.ReadProperty("FGColor", 13684944)
    Line1.BorderColor = PropBag.ReadProperty("BGColor", 10526880)
End Sub

Private Sub UserControl_Resize()

    With UserControl

    .Line1.X1 = 0
    .Line1.Y1 = 0
        
        Select Case m_LineStyle
        Case 0
        .Line1.X2 = .ScaleWidth
        .Line1.Y2 = 0
        .Line2.X1 = 0
        .Line2.X2 = .ScaleWidth
        .Line2.Y1 = 1
        .Line2.Y2 = 1
    
        Case 1
        .Line1.X2 = 0
        .Line1.Y2 = .ScaleHeight
        .Line2.X1 = 1
        .Line2.X2 = 1
        .Line2.Y1 = 1
        .Line2.Y2 = .ScaleHeight
        
        End Select

    End With

End Sub

'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

    Call PropBag.WriteProperty("BorderStyle", UserControl.BorderStyle, 0)
    Call PropBag.WriteProperty("MouseIcon", MouseIcon, Nothing)
    Call PropBag.WriteProperty("MousePointer", UserControl.MousePointer, 0)
    Call PropBag.WriteProperty("LineStyle", m_LineStyle, m_def_LineStyle)
    Call PropBag.WriteProperty("FGColor", Line2.BorderColor, 13684944)
    Call PropBag.WriteProperty("BGColor", Line1.BorderColor, 10526880)
End Sub

