Guest User

BetaBlue VB.Net Theme by ZerO

a guest
Aug 10th, 2011
577
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '            BetaBlue VB.Net Theme
  2.  
  3. ' #############################################
  4. ' #          Creator: iZ3RO (ZerO)            #
  5. ' #          Date: 10 August, 2011            #
  6. ' #               Version: 0.6                #
  7. ' #############################################
  8.  
  9.  
  10. Imports System.Drawing.Drawing2D
  11. Imports System.ComponentModel
  12. Imports System.Runtime.InteropServices
  13.  
  14. MustInherit Class Theme
  15.     Inherits ContainerControl
  16.  
  17. #Region " Initialization "
  18.  
  19.     Protected G As Graphics
  20.     Sub New()
  21.         SetStyle(DirectCast(139270, ControlStyles), True)
  22.     End Sub
  23.  
  24.     Private ParentIsForm As Boolean
  25.     Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  26.         Dock = DockStyle.Fill
  27.         ParentIsForm = TypeOf Parent Is Form
  28.         If ParentIsForm Then
  29.             If Not _TransparencyKey = Color.Empty Then ParentForm.TransparencyKey = _TransparencyKey
  30.             ParentForm.FormBorderStyle = FormBorderStyle.None
  31.         End If
  32.         MyBase.OnHandleCreated(e)
  33.     End Sub
  34.  
  35.     Overrides Property Text As String
  36.         Get
  37.             Return MyBase.Text
  38.         End Get
  39.         Set(ByVal v As String)
  40.             MyBase.Text = v
  41.             Invalidate()
  42.         End Set
  43.     End Property
  44. #End Region
  45.  
  46. #Region " Sizing and Movement "
  47.  
  48.     Private _Resizable As Boolean = True
  49.     Property Resizable() As Boolean
  50.         Get
  51.             Return _Resizable
  52.         End Get
  53.         Set(ByVal value As Boolean)
  54.             _Resizable = value
  55.         End Set
  56.     End Property
  57.  
  58.     Private _MoveHeight As Integer = 24
  59.     Property MoveHeight() As Integer
  60.         Get
  61.             Return _MoveHeight
  62.         End Get
  63.         Set(ByVal v As Integer)
  64.             _MoveHeight = v
  65.             Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  66.         End Set
  67.     End Property
  68.  
  69.     Private Flag As IntPtr
  70.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  71.         If Not e.Button = MouseButtons.Left Then Return
  72.         If ParentIsForm Then If ParentForm.WindowState = FormWindowState.Maximized Then Return
  73.  
  74.         If Header.Contains(e.Location) Then
  75.             Flag = New IntPtr(2)
  76.         ElseIf Current.Position = 0 Or Not _Resizable Then
  77.             Return
  78.         Else
  79.             Flag = New IntPtr(Current.Position)
  80.         End If
  81.  
  82.         Capture = False
  83.         DefWndProc(Message.Create(Parent.Handle, 161, Flag, Nothing))
  84.  
  85.         MyBase.OnMouseDown(e)
  86.     End Sub
  87.  
  88.     Private Structure Pointer
  89.         ReadOnly Cursor As Cursor, Position As Byte
  90.         Sub New(ByVal c As Cursor, ByVal p As Byte)
  91.             Cursor = c
  92.             Position = p
  93.         End Sub
  94.     End Structure
  95.  
  96.     Private F1, F2, F3, F4 As Boolean, PTC As Point
  97.     Private Function GetPointer() As Pointer
  98.         PTC = PointToClient(MousePosition)
  99.         F1 = PTC.X < 7
  100.         F2 = PTC.X > Width - 7
  101.         F3 = PTC.Y < 7
  102.         F4 = PTC.Y > Height - 7
  103.  
  104.         If F1 And F3 Then Return New Pointer(Cursors.SizeNWSE, 13)
  105.         If F1 And F4 Then Return New Pointer(Cursors.SizeNESW, 16)
  106.         If F2 And F3 Then Return New Pointer(Cursors.SizeNESW, 14)
  107.         If F2 And F4 Then Return New Pointer(Cursors.SizeNWSE, 17)
  108.         If F1 Then Return New Pointer(Cursors.SizeWE, 10)
  109.         If F2 Then Return New Pointer(Cursors.SizeWE, 11)
  110.         If F3 Then Return New Pointer(Cursors.SizeNS, 12)
  111.         If F4 Then Return New Pointer(Cursors.SizeNS, 15)
  112.         Return New Pointer(Cursors.Default, 0)
  113.     End Function
  114.  
  115.     Private Current, Pending As Pointer
  116.     Private Sub SetCurrent()
  117.         Pending = GetPointer()
  118.         If Current.Position = Pending.Position Then Return
  119.         Current = GetPointer()
  120.         Cursor = Current.Cursor
  121.     End Sub
  122.  
  123.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  124.         If _Resizable Then SetCurrent()
  125.         MyBase.OnMouseMove(e)
  126.     End Sub
  127.  
  128.     Protected Header As Rectangle
  129.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  130.         If Width = 0 OrElse Height = 0 Then Return
  131.         Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  132.         Invalidate()
  133.         MyBase.OnSizeChanged(e)
  134.     End Sub
  135.  
  136. #End Region
  137.  
  138. #Region " Convienence "
  139.  
  140.     MustOverride Sub PaintHook()
  141.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  142.         If Width = 0 OrElse Height = 0 Then Return
  143.         G = e.Graphics
  144.         PaintHook()
  145.     End Sub
  146.  
  147.     Private _TransparencyKey As Color
  148.     Property TransparencyKey() As Color
  149.         Get
  150.             Return _TransparencyKey
  151.         End Get
  152.         Set(ByVal v As Color)
  153.             _TransparencyKey = v
  154.             Invalidate()
  155.         End Set
  156.     End Property
  157.  
  158.     Private _Image As Image
  159.     Property Image() As Image
  160.         Get
  161.             Return _Image
  162.         End Get
  163.         Set(ByVal value As Image)
  164.             _Image = value
  165.             Invalidate()
  166.         End Set
  167.     End Property
  168.     ReadOnly Property ImageWidth() As Integer
  169.         Get
  170.             If _Image Is Nothing Then Return 0
  171.             Return _Image.Width
  172.         End Get
  173.     End Property
  174.  
  175.     Private _Size As Size
  176.     Private _Rectangle As Rectangle
  177.     Private _Gradient As LinearGradientBrush
  178.     Private _Brush As SolidBrush
  179.  
  180.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  181.         _Brush = New SolidBrush(c)
  182.         G.FillRectangle(_Brush, rect.X, rect.Y, 1, 1)
  183.         G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y, 1, 1)
  184.         G.FillRectangle(_Brush, rect.X, rect.Y + (rect.Height - 1), 1, 1)
  185.         G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), 1, 1)
  186.     End Sub
  187.  
  188.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  189.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  190.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  191.     End Sub
  192.  
  193.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  194.         DrawText(a, c, x, 0)
  195.     End Sub
  196.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  197.         If String.IsNullOrEmpty(Text) Then Return
  198.         _Size = G.MeasureString(Text, Font).ToSize
  199.         _Brush = New SolidBrush(c)
  200.  
  201.         Select Case a
  202.             Case HorizontalAlignment.Left
  203.                 G.DrawString(Text, Font, _Brush, x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  204.             Case HorizontalAlignment.Right
  205.                 G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  206.             Case HorizontalAlignment.Center
  207.                 G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  208.         End Select
  209.     End Sub
  210.  
  211.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  212.         DrawIcon(a, x, 0)
  213.     End Sub
  214.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  215.         If _Image Is Nothing Then Return
  216.         Select Case a
  217.             Case HorizontalAlignment.Left
  218.                 G.DrawImage(_Image, x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  219.             Case HorizontalAlignment.Right
  220.                 G.DrawImage(_Image, Width - _Image.Width - x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  221.             Case HorizontalAlignment.Center
  222.                 G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, _MoveHeight \ 2 - _Image.Height \ 2)
  223.         End Select
  224.     End Sub
  225.  
  226.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  227.         _Rectangle = New Rectangle(x, y, width, height)
  228.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  229.         G.FillRectangle(_Gradient, _Rectangle)
  230.     End Sub
  231.  
  232. #End Region
  233.  
  234. End Class
  235. MustInherit Class ThemeControl
  236.     Inherits Control
  237.  
  238. #Region " Initialization "
  239.  
  240.     Protected G As Graphics, B As Bitmap
  241.     Sub New()
  242.         SetStyle(DirectCast(139270, ControlStyles), True)
  243.         B = New Bitmap(1, 1)
  244.         G = Graphics.FromImage(B)
  245.     End Sub
  246.  
  247.     Sub AllowTransparent()
  248.         SetStyle(ControlStyles.Opaque, False)
  249.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  250.     End Sub
  251.  
  252.     Overrides Property Text As String
  253.         Get
  254.             Return MyBase.Text
  255.         End Get
  256.         Set(ByVal v As String)
  257.             MyBase.Text = v
  258.             Invalidate()
  259.         End Set
  260.     End Property
  261. #End Region
  262.  
  263. #Region " Mouse Handling "
  264.  
  265.     Protected Enum State As Byte
  266.         MouseNone = 0
  267.         MouseOver = 1
  268.         MouseDown = 2
  269.     End Enum
  270.  
  271.     Protected MouseState As State
  272.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  273.         ChangeMouseState(State.MouseNone)
  274.         MyBase.OnMouseLeave(e)
  275.     End Sub
  276.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  277.         ChangeMouseState(State.MouseOver)
  278.         MyBase.OnMouseEnter(e)
  279.     End Sub
  280.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  281.         ChangeMouseState(State.MouseOver)
  282.         MyBase.OnMouseUp(e)
  283.     End Sub
  284.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  285.         If e.Button = MouseButtons.Left Then ChangeMouseState(State.MouseDown)
  286.         MyBase.OnMouseDown(e)
  287.     End Sub
  288.  
  289.     Private Sub ChangeMouseState(ByVal e As State)
  290.         MouseState = e
  291.         Invalidate()
  292.     End Sub
  293.  
  294. #End Region
  295.  
  296. #Region " Convienence "
  297.  
  298.     MustOverride Sub PaintHook()
  299.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  300.         If Width = 0 OrElse Height = 0 Then Return
  301.         PaintHook()
  302.         e.Graphics.DrawImage(B, 0, 0)
  303.     End Sub
  304.  
  305.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  306.         If Not Width = 0 AndAlso Not Height = 0 Then
  307.             B = New Bitmap(Width, Height)
  308.             G = Graphics.FromImage(B)
  309.             Invalidate()
  310.         End If
  311.         MyBase.OnSizeChanged(e)
  312.     End Sub
  313.  
  314.     Private _NoRounding As Boolean
  315.     Property NoRounding() As Boolean
  316.         Get
  317.             Return _NoRounding
  318.         End Get
  319.         Set(ByVal v As Boolean)
  320.             _NoRounding = v
  321.             Invalidate()
  322.         End Set
  323.     End Property
  324.  
  325.     Private _Image As Image
  326.     Property Image() As Image
  327.         Get
  328.             Return _Image
  329.         End Get
  330.         Set(ByVal value As Image)
  331.             _Image = value
  332.             Invalidate()
  333.         End Set
  334.     End Property
  335.     ReadOnly Property ImageWidth() As Integer
  336.         Get
  337.             If _Image Is Nothing Then Return 0
  338.             Return _Image.Width
  339.         End Get
  340.     End Property
  341.     ReadOnly Property ImageTop() As Integer
  342.         Get
  343.             If _Image Is Nothing Then Return 0
  344.             Return Height \ 2 - _Image.Height \ 2
  345.         End Get
  346.     End Property
  347.  
  348.     Private _Size As Size
  349.     Private _Rectangle As Rectangle
  350.     Private _Gradient As LinearGradientBrush
  351.     Private _Brush As SolidBrush
  352.  
  353.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  354.         If _NoRounding Then Return
  355.  
  356.         B.SetPixel(rect.X, rect.Y, c)
  357.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  358.         B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  359.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  360.     End Sub
  361.  
  362.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  363.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  364.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  365.     End Sub
  366.  
  367.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  368.         DrawText(a, c, x, 0)
  369.     End Sub
  370.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  371.         If String.IsNullOrEmpty(Text) Then Return
  372.         _Size = G.MeasureString(Text, Font).ToSize
  373.         _Brush = New SolidBrush(c)
  374.  
  375.         Select Case a
  376.             Case HorizontalAlignment.Left
  377.                 G.DrawString(Text, Font, _Brush, x, Height \ 2 - _Size.Height \ 2 + y)
  378.             Case HorizontalAlignment.Right
  379.                 G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, Height \ 2 - _Size.Height \ 2 + y)
  380.             Case HorizontalAlignment.Center
  381.                 G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, Height \ 2 - _Size.Height \ 2 + y)
  382.         End Select
  383.     End Sub
  384.  
  385.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  386.         DrawIcon(a, x, 0)
  387.     End Sub
  388.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  389.         If _Image Is Nothing Then Return
  390.         Select Case a
  391.             Case HorizontalAlignment.Left
  392.                 G.DrawImage(_Image, x, Height \ 2 - _Image.Height \ 2 + y)
  393.             Case HorizontalAlignment.Right
  394.                 G.DrawImage(_Image, Width - _Image.Width - x, Height \ 2 - _Image.Height \ 2 + y)
  395.             Case HorizontalAlignment.Center
  396.                 G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, Height \ 2 - _Image.Height \ 2)
  397.         End Select
  398.     End Sub
  399.  
  400.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  401.         _Rectangle = New Rectangle(x, y, width, height)
  402.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  403.         G.FillRectangle(_Gradient, _Rectangle)
  404.     End Sub
  405. #End Region
  406.  
  407. End Class
  408. MustInherit Class ThemeContainerControl
  409.     Inherits ContainerControl
  410.  
  411. #Region " Initialization "
  412.  
  413.     Protected G As Graphics, B As Bitmap
  414.     Sub New()
  415.         SetStyle(DirectCast(139270, ControlStyles), True)
  416.         B = New Bitmap(1, 1)
  417.         G = Graphics.FromImage(B)
  418.     End Sub
  419.  
  420.     Sub AllowTransparent()
  421.         SetStyle(ControlStyles.Opaque, False)
  422.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  423.     End Sub
  424.  
  425. #End Region
  426.  
  427. #Region " Convienence "
  428.  
  429.     MustOverride Sub PaintHook()
  430.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  431.         If Width = 0 OrElse Height = 0 Then Return
  432.         PaintHook()
  433.         e.Graphics.DrawImage(B, 0, 0)
  434.     End Sub
  435.  
  436.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  437.         If Not Width = 0 AndAlso Not Height = 0 Then
  438.             B = New Bitmap(Width, Height)
  439.             G = Graphics.FromImage(B)
  440.             Invalidate()
  441.         End If
  442.         MyBase.OnSizeChanged(e)
  443.     End Sub
  444.  
  445.     Private _NoRounding As Boolean
  446.     Property NoRounding() As Boolean
  447.         Get
  448.             Return _NoRounding
  449.         End Get
  450.         Set(ByVal v As Boolean)
  451.             _NoRounding = v
  452.             Invalidate()
  453.         End Set
  454.     End Property
  455.  
  456.     Private _Rectangle As Rectangle
  457.     Private _Gradient As LinearGradientBrush
  458.  
  459.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  460.         If _NoRounding Then Return
  461.         B.SetPixel(rect.X, rect.Y, c)
  462.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  463.         B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  464.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  465.     End Sub
  466.  
  467.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  468.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  469.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  470.     End Sub
  471.  
  472.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  473.         _Rectangle = New Rectangle(x, y, width, height)
  474.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  475.         G.FillRectangle(_Gradient, _Rectangle)
  476.     End Sub
  477. #End Region
  478.  
  479. End Class
  480.  
  481. 'Theme Code
  482. Class BetaBlueTheme
  483.     Inherits Theme
  484.  
  485.     Sub New()
  486.         BackColor = Color.FromKnownColor(KnownColor.Control)
  487.         MoveHeight = 25
  488.         TransparencyKey = Color.Fuchsia
  489.     End Sub
  490.  
  491.     Public Overrides Sub PaintHook()
  492.         G.Clear(BackColor)   ' Clear the form first
  493.         'DrawGradient(Color.FromArgb(0, 105, 246), Color.FromArgb(0, 81, 181), 0, 0, Width, Height, 90S)   ' Form Gradient
  494.         G.Clear(Color.FromArgb(0, 95, 218))
  495.         DrawGradient(Color.FromArgb(0, 95, 218), Color.FromArgb(0, 55, 202), 0, 0, Width, 25, 90S)   ' Form Top Bar
  496.  
  497.         DrawCorners(Color.Fuchsia, ClientRectangle)   ' Then draw some clean corners
  498.         DrawBorders(Pens.DarkBlue, Pens.DodgerBlue, ClientRectangle)   ' Then we draw our form borders
  499.  
  500.         G.DrawLine(Pens.Black, 0, 25, Width, 25)   ' Top Line
  501.         'G.DrawLine(Pens.Black, 0, Height - 25, Width, Height - 25)   ' Bottom Line
  502.  
  503.         DrawText(HorizontalAlignment.Left, Color.White, 8, 2)   ' Finally, we draw our text
  504.     End Sub
  505. End Class ' BetaBlue Theme
  506. Class BetaBlueButton
  507.     Inherits ThemeControl
  508.  
  509.     Private _Dark As Boolean
  510.     Public Property Dark() As Boolean
  511.         Get
  512.             Return _Dark
  513.         End Get
  514.         Set(ByVal v As Boolean)
  515.             _Dark = v
  516.             Invalidate()
  517.         End Set
  518.     End Property
  519.  
  520.     Overrides Sub PaintHook()
  521.         Dim GradA, GradB As Color
  522.         Dim PenColor As Pen = Pens.DodgerBlue
  523.         GradA = Color.FromArgb(0, 105, 246)
  524.         GradB = Color.FromArgb(0, 83, 221)
  525.  
  526.         Select Case Dark
  527.             Case False
  528.                 GradA = Color.FromArgb(0, 105, 246)
  529.                 GradB = Color.FromArgb(0, 83, 221)
  530.                 PenColor = Pens.DodgerBlue
  531.             Case True
  532.                 GradA = Color.FromArgb(62, 62, 62)
  533.                 GradB = Color.FromArgb(38, 38, 38)
  534.                 PenColor = Pens.DimGray
  535.         End Select
  536.  
  537.         Select Case MouseState
  538.             Case State.MouseNone
  539.                 G.Clear(Color.Gray)
  540.                 DrawGradient(GradA, GradB, 0, 0, Width, Height, 90S)
  541.             Case State.MouseOver
  542.                 G.Clear(Color.Gray)
  543.                 DrawGradient(GradA, GradB, 0, 0, Width, Height, 90S)
  544.             Case State.MouseDown
  545.                 G.Clear(Color.DarkGray)
  546.                 DrawGradient(GradB, GradA, 0, 0, Width, Height, 90S)
  547.         End Select
  548.  
  549.         DrawBorders(Pens.Black, PenColor, ClientRectangle)   ' Button Border
  550.         DrawCorners(Color.Black, ClientRectangle)   ' Clean Corners
  551.         DrawText(HorizontalAlignment.Center, Color.White, 0)
  552.     End Sub
  553. End Class ' BetaBlue Button
  554. Class BetaBlueSeperator
  555.     Inherits Control
  556.  
  557.     Private _Orientation As Orientation
  558.     Public Property Orientation() As Orientation
  559.         Get
  560.             Return _Orientation
  561.         End Get
  562.         Set(ByVal v As Orientation)
  563.             _Orientation = v
  564.             UpdateOffset()
  565.             Invalidate()
  566.         End Set
  567.     End Property
  568.  
  569.     Dim G As Graphics, B As Bitmap, I As Integer
  570.     Dim C1 As Color, P1, P2 As Pen
  571.     Sub New()
  572.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint, True)
  573.         C1 = Color.FromArgb(0, 95, 218) 'Background
  574.         P1 = New Pen(Color.FromArgb(55, 55, 55)) 'Shadow
  575.         P2 = New Pen(Color.FromArgb(0, 105, 246)) 'Highlight
  576.     End Sub
  577.  
  578.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  579.         UpdateOffset()
  580.         MyBase.OnSizeChanged(e)
  581.     End Sub
  582.  
  583.     Sub UpdateOffset()
  584.         I = Convert.ToInt32(If(_Orientation = 0, Height / 2 - 1, Width / 2 - 1))
  585.     End Sub
  586.  
  587.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  588.         B = New Bitmap(Width, Height)
  589.         G = Graphics.FromImage(B)
  590.  
  591.         G.Clear(C1)
  592.  
  593.         If _Orientation = 0 Then
  594.             G.DrawLine(P1, 0, I, Width, I)
  595.             G.DrawLine(P2, 0, I + 1, Width, I + 1)
  596.         Else
  597.             G.DrawLine(P2, I, 0, I, Height)
  598.             G.DrawLine(P1, I + 1, 0, I + 1, Height)
  599.         End If
  600.  
  601.         e.Graphics.DrawImage(B, 0, 0)
  602.         G.Dispose()
  603.         B.Dispose()
  604.     End Sub
  605.  
  606.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  607.     End Sub
  608.  
  609. End Class ' BetaBlue Bottom Bar
RAW Paste Data