Advertisement
Maglietta

Untitled

Jun 1st, 2019
5,234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. Public Class LogInSeperator
  2. Inherits Control
  3.  
  4. #Region "Declarations"
  5. Private _SeperatorColour As Color = Color.FromArgb(35, 35, 35)
  6. Private _Alignment As Style = Style.Horizontal
  7. Private _Thickness As Single = 1
  8. #End Region
  9.  
  10. #Region "Properties"
  11.  
  12. Enum Style
  13. Horizontal
  14. Verticle
  15. End Enum
  16.  
  17. <Category("Control")>
  18. Public Property Thickness As Single
  19. Get
  20. Return _Thickness
  21. End Get
  22. Set(value As Single)
  23. _Thickness = value
  24. End Set
  25. End Property
  26.  
  27. <Category("Control")>
  28. Public Property Alignment As Style
  29. Get
  30. Return _Alignment
  31. End Get
  32. Set(value As Style)
  33. _Alignment = value
  34. End Set
  35. End Property
  36.  
  37. <Category("Colours")>
  38. Public Property SeperatorColour As Color
  39. Get
  40. Return _SeperatorColour
  41. End Get
  42. Set(value As Color)
  43. _SeperatorColour = value
  44. End Set
  45. End Property
  46.  
  47. #End Region
  48.  
  49. #Region "Draw Control"
  50. Sub New()
  51. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  52. ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
  53. ControlStyles.SupportsTransparentBackColor, True)
  54. DoubleBuffered = True
  55. BackColor = Color.Transparent
  56. Size = New Size(20, 20)
  57. End Sub
  58.  
  59. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  60. Dim G = e.Graphics
  61. Dim Base As New Rectangle(0, 0, Width - 1, Height - 1)
  62. With G
  63. .SmoothingMode = SmoothingMode.HighQuality
  64. .PixelOffsetMode = PixelOffsetMode.HighQuality
  65. Select Case _Alignment
  66. Case Style.Horizontal
  67. .DrawLine(New Pen(_SeperatorColour, _Thickness), New Point(0, CInt(Height / 2)), New Point(Width, CInt(Height / 2)))
  68. Case Style.Verticle
  69. .DrawLine(New Pen(_SeperatorColour, _Thickness), New Point(CInt(Width / 2), 0), New Point(CInt(Width / 2), Height))
  70. End Select
  71. .InterpolationMode = CType(7, InterpolationMode)
  72. End With
  73. End Sub
  74. #End Region
  75.  
  76. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement