Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1449

Splitter;- or Separator lines Control

$
0
0
I get tired of making splitter lines for programs, therefore I decided to make a control.

Very basic as it's not really my field of expertise, but something that I can use horizontal as well as vertical. What I mean is this:

Name:  Seperator.png
Views: 30
Size:  2.3 KB

This is what's on the form:
Name:  Image 045.png
Views: 22
Size:  4.5 KB
Name:  Image 046.png
Views: 22
Size:  4.5 KB

The code is:

Code:


'Default Property Values:
Const m_def_DarkColour = &H0&
Const m_def_LightColour = &HC0C0C0
Const m_def_Horizonthal = -1
'Property Variables:
Dim m_DarkColour As OLE_COLOR
Dim m_LightColour As OLE_COLOR
Dim m_Horizonthal As Boolean

Private Sub UserControl_Resize()
 
  If Horizonthal = True Then
      Line1.X1 = 0
      Line1.X2 = UserControl.Width
      Line1.Y1 = 0
      Line1.Y2 = 0
     
      Line2.X1 = 0
      Line2.X2 = UserControl.Width
      Line2.Y1 = 20
      Line2.Y2 = 20
      UserControl.Height = 40
  ElseIf Horizonthal = False Then
      Line1.X1 = 0
      Line1.X2 = 0
      Line1.Y1 = 0
      Line1.Y2 = UserControl.Height
     
      Line2.X1 = 20
      Line2.X2 = 20
      Line2.Y1 = 0
      Line2.Y2 = UserControl.Height
      UserControl.Width = 40
  End If
 
End Sub

Public Property Get Enabled() As Boolean
  Enabled = UserControl.Enabled
End Property

Public Property Let Enabled(ByVal New_Enabled As Boolean)
  UserControl.Enabled() = New_Enabled
  PropertyChanged "Enabled"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,&H00000000&
Public Property Get DarkColour() As OLE_COLOR
  DarkColour = m_DarkColour
End Property

Public Property Let DarkColour(ByVal New_DarkColour As OLE_COLOR)
  m_DarkColour = New_DarkColour
  PropertyChanged "DarkColour"
  Line1.BorderColor = m_DarkColour
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=10,0,0,&H00C0C0C0&
Public Property Get LightColour() As OLE_COLOR
  LightColour = m_LightColour
End Property

Public Property Let LightColour(ByVal New_LightColour As OLE_COLOR)
  m_LightColour = New_LightColour
  PropertyChanged "LightColour"
  Line2.BorderColor = m_LightColour
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MemberInfo=0,0,0,-1
Public Property Get Horizonthal() As Boolean
  Horizonthal = m_Horizonthal
End Property

Public Property Let Horizonthal(ByVal New_Horizonthal As Boolean)
  m_Horizonthal = New_Horizonthal
  PropertyChanged "Horizonthal"
End Property

'Initialize Properties for User Control
Private Sub UserControl_InitProperties()
  m_DarkColour = m_def_DarkColour
  m_LightColour = m_def_LightColour
  m_Horizonthal = m_def_Horizonthal
End Sub

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

  UserControl.Enabled = PropBag.ReadProperty("Enabled", True)
  m_DarkColour = PropBag.ReadProperty("DarkColour", m_def_DarkColour)
  m_LightColour = PropBag.ReadProperty("LightColour", m_def_LightColour)
  m_Horizonthal = PropBag.ReadProperty("Horizonthal", m_def_Horizonthal)
End Sub

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

  Call PropBag.WriteProperty("Enabled", UserControl.Enabled, True)
  Call PropBag.WriteProperty("DarkColour", m_DarkColour, m_def_DarkColour)
  Call PropBag.WriteProperty("LightColour", m_LightColour, m_def_LightColour)
  Call PropBag.WriteProperty("Horizonthal", m_Horizonthal, m_def_Horizonthal)
End Sub

Attached Images
   

Viewing all articles
Browse latest Browse all 1449

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>