Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.ComponentModel
- Public Class LabelShadow : Inherits Control
- Public _ShadowColor As Color
- Public _ShadowDistance As Point
- Public Property ShadowColor As Color
- Get
- Return _ShadowColor
- End Get
- Set(ByVal value As Color)
- _ShadowColor = value
- End Set
- End Property
- Public Property ShadowDistance As Point
- Get
- Return _ShadowDistance
- End Get
- Set(ByVal value As Point)
- _ShadowDistance = value
- End Set
- End Property
- Sub New()
- MyBase.New()
- SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
- BackColor = DefaultBackColor
- ForeColor = Color.Black
- Size = New Size(145, 10)
- DoubleBuffered = True
- _ShadowDistance = New Point(1, 1)
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
- Dim B As New Bitmap(Width, Height)
- Dim G As Graphics = Graphics.FromImage(B)
- Dim checkBoxRectangle As New Rectangle(0, 0, Height - 1, Height - 1)
- G.Clear(BackColor)
- 'shadow
- G.DrawString(Text, Font, New SolidBrush(_ShadowColor), New Point(_ShadowDistance), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
- 'text
- G.DrawString(Text, Font, New SolidBrush(ForeColor), New Point(0, 0), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
- e.Graphics.DrawImage(B.Clone(), 0, 0)
- G.Dispose() : B.Dispose()
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment