Public Class ShadowLabel

    Private m_ShadowColor As Color = Color.Black

 

    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)

 

        'Add your custom paint code here

        Dim brFText As SolidBrush = New SolidBrush(Me.ForeColor)

        Dim brRText As SolidBrush = New SolidBrush(Me.ShadowColor)

        Dim gSurface As Screenshots = e.Screenshots

        Dim rectForeGr As RectangleF = gSurface.VisibleClipBounds

        Dim rectBackGr As RectangleF = gSurface.VisibleClipBounds

        rectBackGr.Offset(2, 2)

        gSurface.DrawString(Me.Text, Me.Font, brFText, rectForeGr)

        gSurface.DrawString(Me.Text, Me.Font, brRText, rectBackGr)

        brFText.Dispose()

        brRText.Dispose()

        gSurface.Dispose()

        MyBase.OnPaint(e)

    End Sub

  

    Protected Overrides Sub onTextChanged(ByVal e As EventArgs)

 

        Me.Refresh()

        MyBase.OnTextChanged(e)

       

    End Sub

    Public Property ShadowColor() As Color

        Get

            Return m_ShadowColor

        End Get

        Set(ByVal value As Color)

            m_ShadowColor = value

        End Set

    End Property

 

End Class