Click here to Skip to main content
15,895,746 members
Articles / Programming Languages / Visual Basic

GN Wizard Framework

Rate me:
Please Sign up or sign in to vote.
4.73/5 (51 votes)
21 Dec 2006CPOL3 min read 176.9K   1.7K   94  
A simple Wizard framework.
Imports System.Drawing
Imports System.Windows.Forms

Namespace GNWizardFrameWork
    ''' -----------------------------------------------------------------------------
    ''' Project	 : GNWizardFrameWork
    ''' Class	 : ThreeDLine
    ''' 
    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Simple 3D Line control
    ''' </summary>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[G_Noble]	21/03/2006	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Friend Class ThreeDLine
        Inherits System.Windows.Forms.UserControl
        Dim m_iSpacing As Integer
        Dim m_borderStyle As Border3DStyle = Border3DStyle.Etched

        <System.ComponentModel.Category("Appearance")> _
      Public Property HeaderText() As String
            Get
                Return Text
            End Get
            Set(ByVal Value As String)
                Text = Value
                Me.Invalidate()

            End Set
        End Property

        <System.ComponentModel.Category("Appearance")> _
        Public Property LineStyle() As Border3DStyle
            Get
                Return m_borderStyle
            End Get
            Set(ByVal Value As Border3DStyle)
                If Value <> m_borderStyle Then
                    m_borderStyle = Value
                    Me.Invalidate()
                End If
            End Set
        End Property
        <System.ComponentModel.Category("Appearance")> _
        Public Property Spacing() As Integer
            Get
                Return m_iSpacing
            End Get
            Set(ByVal Value As Integer)
                If Value <> m_iSpacing Then
                    m_iSpacing = Value
                    Me.Invalidate()
                End If
            End Set
        End Property
        Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
            Dim g As Graphics = e.Graphics
            Dim f As Font = Me.Font
            Dim b As Brush = New SolidBrush(Me.ForeColor)
            Dim sf As StringFormat = StringFormat.GenericTypographic
            Dim labelBounds As New RectangleF(0, 0, Me.Width, Me.Height)
            Dim textSize As SizeF = g.MeasureString(Me.Text, f, Me.Width)
            g.DrawString(Me.Text, f, b, 0, 0, sf)
            If textSize.Width + Spacing < Me.Width Then
                Dim startingPoint As Point
                startingPoint.X = textSize.Width + Spacing
                startingPoint.Y = textSize.Height \ 2
                ControlPaint.DrawBorder3D(g, startingPoint.X, _
                startingPoint.Y, _
                 Me.Width - startingPoint.X, _
                 5, m_borderStyle, Border3DSide.Top)
            End If
        End Sub
        Public Sub New()
            Me.SetStyle(ControlStyles.DoubleBuffer, True)
            Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
            Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
            Me.SetStyle(ControlStyles.ResizeRedraw, True)
            updatestyles()
        End Sub

        Private Sub InitializeComponent()
            '
            'ThreeDLine
            '
            Me.Name = "ThreeDLine"
            Me.Size = New System.Drawing.Size(150, 16)

        End Sub
    End Class

End Namespace

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions