Header.vb

 'Programmed by    :   Rey Sean Adorio Cañeso
'Address          :   28 I.B. Upper Calarian, Zamboanga City, Philippines
'Cell No          :   +639154684127
'
' Header.vb
'

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.ComponentModel.Design.Serialization
Imports System.Reflection
Imports System.Drawing.Design
Imports System.Runtime.InteropServices

Public Class Header

#Region "Objects/Variabels"

    Dim _showBorder As Boolean = False

#End Region

#Region "Properties"

    Public Property Title() As String
        Get
            Return Me.lblTitle.Text
        End Get
        Set(ByVal value As String)
            Me.lblTitle.Text = value
        End Set
    End Property
    Public Property Description() As String
        Get
            Return Me.lblDescription.Text
        End Get
        Set(ByVal value As String)
            Me.lblDescription.Text = value
        End Set
    End Property
    Public Property ShowBorder() As Boolean
        Get
            Return Me._showBorder
        End Get
        Set(ByVal value As Boolean)
            Me._showBorder = value
        End Set
    End Property
    Public ReadOnly Property MainImage() As Image
        Get
            Return My.Resources.Header_Main1
        End Get
    End Property
    Public Overloads Property Dock() As DockStyle
        Get
            Return MyBase.Dock
        End Get
        Set(ByVal value As DockStyle)
            MyBase.Dock = value
        End Set
    End Property
    Public Overloads Property ForeColor() As Color
        Get
            Return Me.lblTitle.ForeColor
        End Get
        Set(ByVal value As Color)
            Me.lblTitle.ForeColor = value
        End Set
    End Property
#End Region

#Region "User's Defined Methods"

    Public Sub SetText(ByVal title As String, ByVal description As String)
        Me.lblTitle.Text = title
        Me.lblDescription.Text = description
    End Sub

#End Region

#Region "Events"

    Private Sub Header_Resize(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Resize
        Me.Size = New System.Drawing.Size(Me.Width, 54)
    End Sub
    Private Sub panMain_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles panMain.Paint
        If Me._showBorder Then
            e.Graphics.DrawLine(New System.Drawing.Pen(Color.DodgerBlue), 0, 0, Me.Width - 1, 0)
            e.Graphics.DrawLine(New System.Drawing.Pen(Color.DodgerBlue), 0, 0, 0, Me.Height)
        End If
    End Sub
    Private Sub Header_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles Me.Paint
        If _showBorder Then
            e.Graphics.DrawLine(New System.Drawing.Pen(Color.DodgerBlue), 0, 0, Me.Width - 1, 0)
            e.Graphics.DrawLine(New System.Drawing.Pen(Color.DodgerBlue), Me.Width - 1, 0, Me.Width - 1, Me.Height)
        End If

    End Sub
#End Region

End Class

Project Homepage: