Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class LogInSeperator
- Inherits Control
- #Region "Declarations"
- Private _SeperatorColour As Color = Color.FromArgb(35, 35, 35)
- Private _Alignment As Style = Style.Horizontal
- Private _Thickness As Single = 1
- #End Region
- #Region "Properties"
- Enum Style
- Horizontal
- Verticle
- End Enum
- <Category("Control")>
- Public Property Thickness As Single
- Get
- Return _Thickness
- End Get
- Set(value As Single)
- _Thickness = value
- End Set
- End Property
- <Category("Control")>
- Public Property Alignment As Style
- Get
- Return _Alignment
- End Get
- Set(value As Style)
- _Alignment = value
- End Set
- End Property
- <Category("Colours")>
- Public Property SeperatorColour As Color
- Get
- Return _SeperatorColour
- End Get
- Set(value As Color)
- _SeperatorColour = value
- End Set
- End Property
- #End Region
- #Region "Draw Control"
- Sub New()
- SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
- ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
- ControlStyles.SupportsTransparentBackColor, True)
- DoubleBuffered = True
- BackColor = Color.Transparent
- Size = New Size(20, 20)
- End Sub
- Protected Overrides Sub OnPaint(e As PaintEventArgs)
- Dim G = e.Graphics
- Dim Base As New Rectangle(0, 0, Width - 1, Height - 1)
- With G
- .SmoothingMode = SmoothingMode.HighQuality
- .PixelOffsetMode = PixelOffsetMode.HighQuality
- Select Case _Alignment
- Case Style.Horizontal
- .DrawLine(New Pen(_SeperatorColour, _Thickness), New Point(0, CInt(Height / 2)), New Point(Width, CInt(Height / 2)))
- Case Style.Verticle
- .DrawLine(New Pen(_SeperatorColour, _Thickness), New Point(CInt(Width / 2), 0), New Point(CInt(Width / 2), Height))
- End Select
- .InterpolationMode = CType(7, InterpolationMode)
- End With
- End Sub
- #End Region
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement