LaPanthere

Sky Dark Theme

Jun 16th, 2013
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 37.10 KB | None | 0 0
  1. Imports System.Drawing.Drawing2D
  2. ''' <summary>
  3. ''' Credits
  4. ''' </summary>
  5. ''' <remarks>
  6. '''
  7. ''' Contact:
  8. ''' Tedd           - HackForums.net Forum
  9. '''
  10. ''' </remarks>
  11. Module ConversionFunctions
  12.     Function ToBrush(ByVal A As Integer, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Brush
  13.         Return New SolidBrush(Color.FromArgb(A, R, G, B))
  14.     End Function
  15.     Function ToBrush(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Brush
  16.         Return New SolidBrush(Color.FromArgb(R, G, B))
  17.     End Function
  18.     Function ToBrush(ByVal A As Integer, ByVal C As Color) As Brush
  19.         Return New SolidBrush(Color.FromArgb(A, C))
  20.     End Function
  21.     Function ToBrush(ByVal Pen As Pen) As Brush
  22.         Return New SolidBrush(Pen.Color)
  23.     End Function
  24.     Function ToBrush(ByVal Color As Color) As Brush
  25.         Return New SolidBrush(Color)
  26.     End Function
  27.     Function ToPen(ByVal A As Integer, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Pen
  28.         Return New Pen(New SolidBrush(Color.FromArgb(A, R, G, B)))
  29.     End Function
  30.     Function ToPen(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Pen
  31.         Return New Pen(New SolidBrush(Color.FromArgb(R, G, B)))
  32.     End Function
  33.     Function ToPen(ByVal A As Integer, ByVal C As Color) As Pen
  34.         Return New Pen(New SolidBrush(Color.FromArgb(A, C)))
  35.     End Function
  36.     Function ToPen(ByVal Brush As SolidBrush) As Pen
  37.         Return New Pen(Brush)
  38.     End Function
  39.     Function ToPen(ByVal Color As Color) As Pen
  40.         Return New Pen(New SolidBrush(Color))
  41.     End Function
  42. End Module
  43.  
  44. Module Shapes
  45.     Public Function Triangle(ByVal Location As Point, ByVal Size As Size) As Point()
  46.         Dim ReturnPoints(0 To 3) As Point
  47.         ReturnPoints(0) = Location
  48.         ReturnPoints(1) = New Point(Location.X + Size.Width, Location.Y)
  49.         ReturnPoints(2) = New Point(Location.X + Size.Width \ 2, Location.Y + Size.Height)
  50.         ReturnPoints(3) = Location
  51.  
  52.         Return ReturnPoints
  53.     End Function
  54.     Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  55.         Return RoundRect(Rectangle.X, Rectangle.Y, Rectangle.Width, Rectangle.Height, Curve)
  56.     End Function
  57.     Public Function RoundRect(ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal Curve As Integer) As GraphicsPath
  58.         Dim Rectangle As Rectangle = New Rectangle(X, Y, Width, Height)
  59.         Dim P As GraphicsPath = New GraphicsPath()
  60.         Dim ArcRectangleWidth As Integer = Curve * 2
  61.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  62.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  63.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  64.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  65.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  66.         Return P
  67.     End Function
  68. End Module
  69.  
  70. Public Class SkyDarkForm
  71.     Inherits ContainerControl
  72.     Dim WithEvents Maxim As SkyDarkTop
  73.     Dim WithEvents Exim As SkyDarkTop
  74.     Private Locked As Boolean = False
  75.     Private Locked1 As Point = Nothing
  76.  
  77.     Sub New()
  78.         Dock = DockStyle.Fill
  79.         SendToBack()
  80.         BackColor = Color.FromArgb(62, 60, 58)
  81.     End Sub
  82.  
  83.     Protected Overrides Sub OnHandleCreated(ByVal e As System.EventArgs)
  84.         Parent.FindForm.FormBorderStyle = FormBorderStyle.None
  85.         Maxim = New SkyDarkTop With {.Location = New Point(Width - 41, 3), .Size = New Size(14, 14), .Parent = Me}
  86.         Exim = New SkyDarkTop With {.Location = New Point(Width - 22, 3), .Size = New Size(14, 14), .Parent = Me}
  87.         Me.Controls.Add(Maxim)
  88.         Me.Controls.Add(Exim)
  89.         Maxim.Show()
  90.         Exim.Show()
  91.     End Sub
  92.     Dim T1 As New Rectangle(1, 1, Width - 3, 18)
  93.     Dim C1 As Color = Color.FromArgb(62, 60, 58)
  94.     Dim C2 As Color = Color.FromArgb(81, 79, 77)
  95.     Dim C3 As Color = Color.FromArgb(71, 70, 69)
  96.     Dim C4 As Color = Color.FromArgb(58, 56, 54)
  97.  
  98.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  99.         Dim B As New Bitmap(Width, Height)
  100.         Dim G As Graphics = Graphics.FromImage(B)
  101.  
  102.         'Drawing
  103.         G.Clear(C1)
  104.         Dim G1 As New LinearGradientBrush(New Point(T1.X, T1.Y), New Point(T1.X, T1.Y + T1.Height), C3, C4)
  105.         G.FillRectangle(G1, T1)
  106.         G.DrawRectangle(ToPen(C2), T1)
  107.         G.DrawRectangle(ToPen(C2), New Rectangle(T1.X, T1.Y + T1.Height + 2, T1.Width, Height - T1.Y - T1.Height - 4))
  108.  
  109.         G1.Dispose()
  110.  
  111.         G.DrawString(Text, Font, ToBrush(113, 170, 186), _
  112.                      New Rectangle(New Point(T1.X + 4, T1.Y), New Size(T1.Width - 40, T1.Height)), _
  113.                      New StringFormat With {.LineAlignment = StringAlignment.Center})
  114.  
  115.  
  116.         'Finish Up
  117.         e.Graphics.DrawImage(B.Clone, 0, 0)
  118.         G.Dispose() : B.Dispose()
  119.     End Sub
  120.  
  121.     Private Sub Exim_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Exim.Click
  122.         Parent.FindForm.Close()
  123.     End Sub
  124.  
  125.     Private Sub Maxim_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Maxim.Click
  126.         Parent.FindForm.WindowState = FormWindowState.Minimized
  127.     End Sub
  128.  
  129.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  130.         MyBase.OnMouseUp(e) : Locked = False : Locked1 = Nothing
  131.     End Sub
  132.  
  133.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  134.         MyBase.OnMouseDown(e) : If T1.Contains(e.Location) Then : Locked = True : Locked1 = e.Location : End If
  135.     End Sub
  136.  
  137.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  138.         MyBase.OnMouseMove(e) : If Locked Then Parent.Location = Cursor.Position - Locked1
  139.     End Sub
  140.  
  141.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  142.         MyBase.OnResize(e) : T1 = New Rectangle(1, 1, Width - 3, 18)
  143.     End Sub
  144. End Class
  145.  
  146. Public Class SkyDarkButton
  147.     Inherits Control
  148.  
  149. #Region "Properties"
  150.     Public Overrides Property Text As String
  151.         Get
  152.             Return MyBase.Text
  153.         End Get
  154.         Set(ByVal value As String)
  155.             MyBase.Text = value
  156.             Invalidate()
  157.         End Set
  158.     End Property
  159. #End Region
  160.  
  161.     Sub New()
  162.         DoubleBuffered = True
  163.     End Sub
  164.  
  165.     Dim C1 As Color = Color.FromArgb(51, 49, 47)
  166.     Dim C2 As Color = Color.FromArgb(90, 91, 90)
  167.     Dim C3 As Color = Color.FromArgb(70, 71, 70)
  168.     Dim C4 As Color = Color.FromArgb(62, 61, 58)
  169.  
  170.  
  171.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  172.         Dim B As New Bitmap(Width, Height)
  173.         Dim G As Graphics = Graphics.FromImage(B)
  174.  
  175.         Dim G1 As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), C3, C4)
  176.         G.FillRectangle(G1, 0, 0, Width, Height)
  177.         G1.Dispose()
  178.  
  179.         If Enabled Then
  180.             Select Case State
  181.                 Case MouseState.Over
  182.                     G.FillRectangle(New SolidBrush(Color.FromArgb(20, Color.White)), New Rectangle(0, 0, Width, Height))
  183.                 Case MouseState.Down
  184.                     G.FillRectangle(New SolidBrush(Color.FromArgb(10, Color.Black)), New Rectangle(0, 0, Width, Height))
  185.             End Select
  186.         End If
  187.  
  188.         Dim S1 As New StringFormat
  189.         S1.LineAlignment = StringAlignment.Center
  190.         S1.Alignment = StringAlignment.Center
  191.  
  192.         Select Case Enabled
  193.             Case True
  194.                 G.DrawString(Text, Font, ToBrush(113, 170, 186), New Rectangle(0, 0, Width - 1, Height - 1), S1)
  195.             Case False
  196.                 G.DrawString(Text, Font, Brushes.Gray, New Rectangle(0, 0, Width - 1, Height - 1), S1)
  197.         End Select
  198.  
  199.         S1.Dispose()
  200.  
  201.         G.DrawRectangle(ToPen(C1), 0, 0, Width - 1, Height - 1)
  202.         G.DrawRectangle(ToPen(C2), 1, 1, Width - 3, Height - 3)
  203.  
  204.         e.Graphics.DrawImage(B.Clone, 0, 0)
  205.         G.Dispose() : B.Dispose()
  206.     End Sub
  207.  
  208. #Region "Mouse States"
  209.     Enum MouseState
  210.         None
  211.         Over
  212.         Down
  213.     End Enum
  214.     Private ms As MouseState
  215.     Private Property State() As MouseState
  216.         Get
  217.             Return ms
  218.         End Get
  219.         Set(ByVal value As MouseState)
  220.             ms = value
  221.             Invalidate()
  222.         End Set
  223.     End Property
  224.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  225.         MyBase.OnMouseEnter(e) : State = MouseState.Over
  226.     End Sub
  227.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  228.         MyBase.OnMouseLeave(e) : State = MouseState.None
  229.     End Sub
  230.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  231.         MyBase.OnMouseDown(e) : State = MouseState.Down
  232.     End Sub
  233.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  234.         MyBase.OnMouseUp(e) : State = MouseState.Over
  235.     End Sub
  236. #End Region
  237. End Class
  238.  
  239. Public Class SkyDarkProgress
  240.     Inherits Control
  241.  
  242. #Region "Properties"
  243.     Private val As Integer
  244.     Public Property Value() As Integer
  245.         Get
  246.             Return val
  247.         End Get
  248.         Set(ByVal _value As Integer)
  249.             If _value > max Then
  250.                 val = max
  251.             ElseIf _value < 0 Then
  252.                 val = 0
  253.             Else
  254.                 val = _value
  255.             End If
  256.             Invalidate()
  257.         End Set
  258.     End Property
  259.     Private max As Integer
  260.     Public Property Maximum() As Integer
  261.         Get
  262.             Return max
  263.         End Get
  264.         Set(ByVal _value As Integer)
  265.             If _value < 1 Then
  266.                 max = 1
  267.             Else
  268.                 max = _value
  269.             End If
  270.  
  271.             If _value < val Then
  272.                 val = max
  273.             End If
  274.  
  275.             Invalidate()
  276.         End Set
  277.     End Property
  278. #End Region
  279.     Dim C1 As Color = Color.FromArgb(51, 49, 47)
  280.     Dim C2 As Color = Color.FromArgb(81, 77, 77)
  281.     Dim C3 As Color = Color.FromArgb(64, 60, 59)
  282.     Dim C4 As Color = Color.FromArgb(70, 71, 70)
  283.     Dim C5 As Color = Color.FromArgb(62, 59, 58)
  284.  
  285.     Sub New()
  286.         max = 100
  287.     End Sub
  288.  
  289.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  290.         Dim B As New Bitmap(Width, Height)
  291.         Dim G As Graphics = Graphics.FromImage(B)
  292.         Dim Fill As Rectangle = New Rectangle(3, 3, CInt((Width - 7) * (val / max)), Height - 7)
  293.  
  294.         G.Clear(C5)
  295.  
  296.         Dim G1 As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), C3, C4)
  297.         G.FillRectangle(G1, Fill)
  298.         G1.Dispose()
  299.         G.DrawRectangle(ToPen(C2), Fill)
  300.  
  301.         G.DrawRectangle(ToPen(C1), 0, 0, Width - 1, Height - 1)
  302.         G.DrawRectangle(ToPen(C2), 1, 1, Width - 3, Height - 3)
  303.  
  304.         e.Graphics.DrawImage(B.Clone, 0, 0)
  305.         G.Dispose() : B.Dispose()
  306.     End Sub
  307. End Class
  308.  
  309. Public Class SkyDarkTabControl
  310.     Inherits TabControl
  311.  
  312.     Sub New()
  313.         SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  314.         ControlStyles.ResizeRedraw Or _
  315.         ControlStyles.UserPaint Or _
  316.         ControlStyles.DoubleBuffer, True)
  317.         DoubleBuffered = True
  318.     End Sub
  319.     Protected Overrides Sub CreateHandle()
  320.         MyBase.CreateHandle()
  321.         Alignment = TabAlignment.Top
  322.     End Sub
  323.     Dim C1 As Color = Color.FromArgb(62, 60, 58)
  324.     Dim C2 As Color = Color.FromArgb(80, 78, 76)
  325.     Dim C3 As Color = Color.FromArgb(51, 49, 47)
  326.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  327.         Dim B As New Bitmap(Width, Height)
  328.         Dim G As Graphics = Graphics.FromImage(B)
  329.         Try : SelectedTab.BackColor = C1 : Catch : End Try
  330.         G.Clear(Parent.BackColor)
  331.         For i = 0 To TabCount - 1
  332.             If Not i = SelectedIndex Then
  333.                 Dim x2 As Rectangle = New Rectangle(GetTabRect(i).X, GetTabRect(i).Y + 3, GetTabRect(i).Width + 2, GetTabRect(i).Height)
  334.                 Dim G1 As New LinearGradientBrush(New Point(x2.X, x2.Y), New Point(x2.X, x2.Y + x2.Height), Color.FromArgb(60, 59, 58), Color.FromArgb(69, 69, 70))
  335.                 G.FillRectangle(G1, x2) : G1.Dispose()
  336.                 G.DrawRectangle(ToPen(C3), x2)
  337.                 G.DrawRectangle(ToPen(C2), New Rectangle(x2.X + 1, x2.Y + 1, x2.Width - 2, x2.Height))
  338.                 G.DrawString(TabPages(i).Text, Font, ToBrush(130, 176, 190), x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  339.             End If
  340.         Next
  341.  
  342.         G.FillRectangle(ToBrush(C1), 0, ItemSize.Height, Width, Height)
  343.         G.DrawRectangle(ToPen(C2), 0, ItemSize.Height, Width - 1, Height - ItemSize.Height - 1)
  344.         G.DrawRectangle(ToPen(C3), 1, ItemSize.Height + 1, Width - 3, Height - ItemSize.Height - 3)
  345.         If Not SelectedIndex = -1 Then
  346.             Dim x1 As Rectangle = New Rectangle(GetTabRect(SelectedIndex).X - 2, GetTabRect(SelectedIndex).Y, GetTabRect(SelectedIndex).Width + 3, GetTabRect(SelectedIndex).Height)
  347.             G.FillRectangle(ToBrush(C1), New Rectangle(x1.X + 2, x1.Y + 2, x1.Width - 2, x1.Height))
  348.             G.DrawLine(ToPen(C2), New Point(x1.X, x1.Y + x1.Height - 2), New Point(x1.X, x1.Y))
  349.             G.DrawLine(ToPen(C2), New Point(x1.X, x1.Y), New Point(x1.X + x1.Width, x1.Y))
  350.             G.DrawLine(ToPen(C2), New Point(x1.X + x1.Width, x1.Y), New Point(x1.X + x1.Width, x1.Y + x1.Height - 2))
  351.  
  352.             G.DrawLine(ToPen(C3), New Point(x1.X + 1, x1.Y + x1.Height - 1), New Point(x1.X + 1, x1.Y + 1))
  353.             G.DrawLine(ToPen(C3), New Point(x1.X + 1, x1.Y + 1), New Point(x1.X + x1.Width - 1, x1.Y + 1))
  354.             G.DrawLine(ToPen(C3), New Point(x1.X + x1.Width - 1, x1.Y + 1), New Point(x1.X + x1.Width - 1, x1.Y + x1.Height - 1))
  355.  
  356.             G.DrawString(TabPages(SelectedIndex).Text, Font, ToBrush(130, 176, 190), x1, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  357.         End If
  358.  
  359.         e.Graphics.DrawImage(B.Clone, 0, 0)
  360.         G.Dispose() : B.Dispose()
  361.     End Sub
  362. End Class
  363.  
  364. Public Class SkyDarkCombo
  365.     Inherits ComboBox
  366.     Sub New()
  367.         MyBase.New()
  368.         SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  369.         ControlStyles.ResizeRedraw Or _
  370.         ControlStyles.UserPaint Or _
  371.         ControlStyles.DoubleBuffer, True)
  372.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  373.         BackColor = Color.FromArgb(235, 235, 235)
  374.         ForeColor = Color.FromArgb(31, 31, 31)
  375.         DropDownStyle = ComboBoxStyle.DropDownList
  376.     End Sub
  377.     Private _StartIndex As Integer = 0
  378.     Public Property StartIndex As Integer
  379.         Get
  380.             Return _StartIndex
  381.         End Get
  382.         Set(ByVal value As Integer)
  383.             _StartIndex = value
  384.             Try
  385.                 MyBase.SelectedIndex = value
  386.             Catch
  387.             End Try
  388.             Invalidate()
  389.         End Set
  390.     End Property
  391.  
  392.     Dim C1 As Color = Color.FromArgb(48, 48, 48)
  393.     Dim C2 As Color = Color.FromArgb(81, 79, 77)
  394.     Dim C3 As Color = Color.FromArgb(62, 60, 58)
  395.  
  396.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  397.         If Not DropDownStyle = ComboBoxStyle.DropDownList Then DropDownStyle = ComboBoxStyle.DropDownList
  398.         Dim B As New Bitmap(Width, Height)
  399.         Dim G As Graphics = Graphics.FromImage(B)
  400.  
  401.         G.Clear(C3)
  402.  
  403.  
  404.         Dim S1 As Integer = G.MeasureString("...", Font).Height
  405.         If SelectedIndex <> -1 Then
  406.  
  407.             G.DrawString(Items(SelectedIndex), Font, ToBrush(152, 182, 192), 4, Height \ 2 - S1 \ 2)
  408.         Else
  409.             If Not Items Is Nothing And Items.Count > 0 Then
  410.                 G.DrawString(Items(0), Font, ToBrush(152, 182, 192), 4, Height \ 2 - S1 \ 2)
  411.             Else
  412.                 G.DrawString("...", Font, ToBrush(152, 182, 192), 4, Height \ 2 - S1 \ 2)
  413.             End If
  414.         End If
  415.  
  416.         Dim G1 As New LinearGradientBrush(New Point(Width - 30, Height \ 2), New Point(Width - 22, Height \ 2), Color.Transparent, C3)
  417.         G.FillRectangle(G1, Width - 30, 0, 8, Height)
  418.  
  419.         G.DrawRectangle(ToPen(C1), New Rectangle(0, 0, Width - 1, Height - 1))
  420.         G.DrawLine(ToPen(C1), New Point(Width - 21, 0), New Point(Width - 21, Height))
  421.  
  422.         G.DrawRectangle(ToPen(C2), 1, 1, Width - 23, Height - 3)
  423.  
  424.         G.FillRectangle(ToBrush(C3), Width - 20, 1, 18, Height - 3)
  425.         G.FillRectangle(ToBrush(10, Color.White), Width - 20, 1, 18, Height - 3)
  426.         G.DrawRectangle(ToPen(C2), Width - 20, 1, 18, Height - 3)
  427.  
  428.         G.FillPolygon(Brushes.Black, Shapes.Triangle(New Point(Width - 12, Height \ 2), New Size(5, 3)))
  429.         G.FillPolygon(Brushes.LightBlue, Shapes.Triangle(New Point(Width - 13, Height \ 2 - 1), New Size(5, 3)))
  430.  
  431.         e.Graphics.DrawImage(B.Clone, 0, 0)
  432.         G.Dispose() : B.Dispose()
  433.     End Sub
  434.     Sub ReplaceItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  435.         Dim G As Graphics = e.Graphics
  436.         Dim C4 As Color = Color.Empty
  437.         e.DrawBackground()
  438.         Try
  439.             If e.State And DrawItemState.Selected = DrawItemState.Selected Then
  440.                 G.FillRectangle(ToBrush(50, 80, 120), New Rectangle(e.Bounds.X - 1, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height + 2))
  441.                 G.DrawRectangle(New Pen(ToBrush(180, Color.Black), 1), New Rectangle(e.Bounds.X - 1, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height + 2))
  442.                 C4 = Color.FromArgb(100, 165, 185)
  443.             Else
  444.                 G.FillRectangle(ToBrush(62, 60, 58), New Rectangle(e.Bounds.X - 1, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height + 2))
  445.                 C4 = Color.FromArgb(200, 200, 200)
  446.             End If
  447.  
  448.             G.DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), e.Font, ToBrush(C4), e.Bounds, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  449.         Catch : End Try
  450.     End Sub
  451.  
  452.     Private Sub SkyDarkCombo_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.TextChanged
  453.         Invalidate()
  454.     End Sub
  455. End Class
  456.  
  457. Public Class SkyDarkTop
  458.     Inherits Control
  459.  
  460.     Sub New()
  461.         DoubleBuffered = True
  462.         Size = New Size(10, 10)
  463.     End Sub
  464.     Dim C1 As Color = Color.FromArgb(94, 103, 106)
  465.     Dim C2 As Color = Color.FromArgb(152, 182, 192)
  466.     Dim CD As Color = Color.FromArgb(86, 94, 96)
  467.     Dim C3 As Color = Color.FromArgb(71, 70, 69)
  468.     Dim C4 As Color = Color.FromArgb(58, 56, 54)
  469.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  470.         Dim B As New Bitmap(Width, Height)
  471.         Dim G As Graphics = Graphics.FromImage(B)
  472.         Dim G1 As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), C3, C4)
  473.         G.FillRectangle(G1, ClientRectangle)
  474.         G1.Dispose()
  475.         G.SmoothingMode = SmoothingMode.HighQuality
  476.         Select Case State
  477.             Case MouseState.None
  478.                 G.DrawEllipse(New Pen(C1, 2), New Rectangle(2, 2, Width - 5, Height - 5))
  479.             Case MouseState.Over
  480.                 G.DrawEllipse(New Pen(C2, 2), New Rectangle(2, 2, Width - 5, Height - 5))
  481.             Case MouseState.Down
  482.                 G.DrawEllipse(New Pen(CD, 2), New Rectangle(2, 2, Width - 5, Height - 5))
  483.         End Select
  484.  
  485.         G.FillEllipse(ToBrush(C2), New Rectangle(5, 5, Width - 11, Height - 11))
  486.  
  487.         e.Graphics.DrawImage(B.Clone, 0, 0)
  488.         G.Dispose() : B.Dispose()
  489.     End Sub
  490.  
  491. #Region "Mouse States"
  492.     Enum MouseState
  493.         None
  494.         Over
  495.         Down
  496.     End Enum
  497.     Private ms As MouseState
  498.     Private Property State() As MouseState
  499.         Get
  500.             Return ms
  501.         End Get
  502.         Set(ByVal value As MouseState)
  503.             ms = value
  504.             Invalidate()
  505.         End Set
  506.     End Property
  507.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  508.         MyBase.OnMouseEnter(e) : State = MouseState.Over
  509.     End Sub
  510.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  511.         MyBase.OnMouseLeave(e) : State = MouseState.None
  512.     End Sub
  513.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  514.         MyBase.OnMouseDown(e) : State = MouseState.Down
  515.     End Sub
  516.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  517.         MyBase.OnMouseUp(e) : State = MouseState.Over
  518.     End Sub
  519. #End Region
  520. End Class
  521.  
  522. Public Class SkyDarkSeperator
  523.     Inherits Control
  524.  
  525.     Public Enum Alignment
  526.         Vertical
  527.         Horizontal
  528.     End Enum
  529.  
  530.     Private al As Alignment
  531.     Public Property Align() As Alignment
  532.         Get
  533.             Return al
  534.         End Get
  535.         Set(ByVal value As Alignment)
  536.             al = value
  537.             Invalidate()
  538.         End Set
  539.     End Property
  540.  
  541.     Dim C1 As Color = Color.FromArgb(51, 49, 47)
  542.     Dim C2 As Color = Color.FromArgb(90, 91, 90)
  543.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  544.         Dim B As New Bitmap(Width, Height)
  545.         Dim G As Graphics = Graphics.FromImage(B)
  546.  
  547.         Select Case Align
  548.             Case Alignment.Horizontal
  549.                 G.DrawLine(ToPen(C1), New Point(0, Height \ 2), New Point(Width, Height \ 2))
  550.                 G.DrawLine(ToPen(C2), New Point(0, Height \ 2 + 1), New Point(Width, Height \ 2 + 1))
  551.             Case Alignment.Vertical
  552.                 G.DrawLine(ToPen(C1), New Point(Width \ 2, 0), New Point(Width \ 2, Height))
  553.                 G.DrawLine(ToPen(C2), New Point(Width \ 2 + 1, 0), New Point(Width \ 2 + 1, Height))
  554.         End Select
  555.  
  556.         e.Graphics.DrawImage(B, 0, 0)
  557.         G.Dispose() : B.Dispose()
  558.     End Sub
  559. End Class
  560.  
  561. Public Class SkyDarkCheck
  562.     Inherits Control
  563.  
  564.     Enum MouseState
  565.         None
  566.         Down
  567.     End Enum
  568.  
  569. #Region "Properties"
  570.  
  571.     Private chk As Boolean
  572.     Public Property Checked() As Boolean
  573.         Get
  574.             Return chk
  575.         End Get
  576.         Set(ByVal value As Boolean)
  577.             chk = value
  578.             Invalidate()
  579.         End Set
  580.     End Property
  581.  
  582.     Private ms As MouseState
  583.     Public Property State() As MouseState
  584.         Get
  585.             Return ms
  586.         End Get
  587.         Set(ByVal value As MouseState)
  588.             ms = value
  589.             invalidate()
  590.         End Set
  591.     End Property
  592.  
  593. #End Region
  594.  
  595.     Dim C1 As Color = Color.FromArgb(51, 49, 47)
  596.     Dim C2 As Color = Color.FromArgb(80, 77, 77)
  597.  
  598.     Dim C3 As Color = Color.FromArgb(70, 69, 68)
  599.     Dim C4 As Color = Color.FromArgb(64, 60, 59)
  600.     Dim C5 As Color = Color.Transparent
  601.  
  602.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  603.         Dim B As New Bitmap(Width, Height)
  604.         Dim G As Graphics = Graphics.FromImage(B)
  605.  
  606.         G.Clear(Parent.BackColor)
  607.         C3 = Color.FromArgb(70, 69, 68)
  608.         C4 = Color.FromArgb(64, 60, 59)
  609.         Select Case Enabled
  610.             Case True
  611.                 Select Case State
  612.                     Case MouseState.Down
  613.                         C5 = Color.FromArgb(121, 151, 160)
  614.                         C3 = Color.FromArgb(64, 60, 59)
  615.                         C4 = Color.FromArgb(70, 69, 68)
  616.                     Case MouseState.None
  617.                         C5 = Color.FromArgb(151, 181, 190)
  618.                 End Select
  619.             Case False
  620.                 C5 = Color.FromArgb(88, 88, 88)
  621.         End Select
  622.  
  623.         Dim chkRec As New Rectangle(0, 0, Height - 1, Height - 1)
  624.         Dim G1 As New LinearGradientBrush(New Point(chkRec.X, chkRec.Y), New Point(chkRec.X, chkRec.Y + chkRec.Height), C3, C4)
  625.         G.FillRectangle(G1, chkRec) : G1.Dispose()
  626.         G.DrawRectangle(ToPen(C1), chkRec)
  627.         G.DrawRectangle(ToPen(C2), New Rectangle(chkRec.X + 1, chkRec.Y + 1, chkRec.Width - 2, chkRec.Height - 2))
  628.         Dim chkPoly As Rectangle = New Rectangle(chkRec.X + chkRec.Width / 4, chkRec.Y + chkRec.Height / 4, chkRec.Width \ 2, chkRec.Height \ 2)
  629.         Dim Poly() As Point = {New Point(chkPoly.X, chkPoly.Y + chkPoly.Height \ 2), _
  630.                        New Point(chkPoly.X + chkPoly.Width \ 2, chkPoly.Y + chkPoly.Height), _
  631.                        New Point(chkPoly.X + chkPoly.Width, chkPoly.Y)}
  632.  
  633.         If Checked Then
  634.             G.SmoothingMode = SmoothingMode.HighQuality
  635.             Dim P1 As New Pen(ToBrush(C5), 2)
  636.             For i = 0 To Poly.Length - 2
  637.                 G.DrawLine(P1, Poly(i), Poly(i + 1))
  638.             Next
  639.         End If
  640.         G.DrawString(Text, Font, ToBrush(C5), New Rectangle(chkRec.X + chkRec.Width + 5, 0, Width - chkRec.X - chkRec.Width - 5, Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  641.  
  642.         e.Graphics.DrawImage(B, 0, 0)
  643.         G.Dispose() : B.Dispose()
  644.     End Sub
  645.  
  646.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  647.         If Enabled Then : State = MouseState.None : Checked = Not Checked : End If
  648.     End Sub
  649.  
  650.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  651.         If Enabled Then : State = MouseState.Down : End If
  652.     End Sub
  653. End Class
  654.  
  655. Public Class SkyDarkRadio
  656.     Inherits Control
  657.  
  658.     Enum MouseState
  659.         None
  660.         Down
  661.     End Enum
  662.  
  663. #Region "Properties"
  664.  
  665.     Private ms As MouseState
  666.     Public Property State() As MouseState
  667.         Get
  668.             Return ms
  669.         End Get
  670.         Set(ByVal value As MouseState)
  671.             ms = value
  672.             Invalidate()
  673.         End Set
  674.     End Property
  675.  
  676.     Private chk As Boolean
  677.     Public Property Checked() As Boolean
  678.         Get
  679.             Return chk
  680.         End Get
  681.         Set(ByVal value As Boolean)
  682.             chk = value
  683.             Invalidate()
  684.             ''Error code: Whenever I add this it overflows like an infinite loop...
  685.             Try
  686.                 If value Then
  687.                     For Each ctl In Parent.Controls
  688.                         If TypeOf ctl Is SkyDarkRadio Then
  689.                             If Not ctl Is Me And DirectCast(ctl, SkyDarkRadio).Enabled Then
  690.                                 DirectCast(ctl, SkyDarkRadio).Checked = False
  691.                             End If
  692.                         End If
  693.                     Next
  694.                 End If
  695.             Catch : End Try
  696.         End Set
  697.     End Property
  698.  
  699. #End Region
  700.  
  701.     Sub New()
  702.         Size = New Size(Width, 13)
  703.     End Sub
  704.  
  705.     Dim C1 As Color = Color.FromArgb(35, 35, 35)
  706.     Dim C2 As Color = Color.Transparent
  707.     Dim C3 As Color = Color.Transparent
  708.     Dim C4 As Color = Color.Transparent
  709.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  710.         Dim B As New Bitmap(Width, Height)
  711.         Dim G As Graphics = Graphics.FromImage(B)
  712.  
  713.         G.Clear(Parent.BackColor)
  714.  
  715.         Select Case Enabled
  716.             Case True
  717.                 Select Case State
  718.                     Case MouseState.None
  719.                         C2 = Color.FromArgb(70, 70, 70)
  720.                         C3 = Color.FromArgb(54, 54, 51)
  721.                         C4 = Color.FromArgb(152, 182, 192)
  722.                     Case MouseState.Down
  723.                         C2 = Color.FromArgb(54, 54, 51)
  724.                         C3 = Color.FromArgb(70, 70, 70)
  725.                         C4 = Color.FromArgb(112, 142, 152)
  726.                 End Select
  727.             Case False
  728.                 C2 = Color.FromArgb(70, 70, 70)
  729.                 C3 = Color.FromArgb(54, 54, 51)
  730.                 C4 = Color.FromArgb(89, 88, 88)
  731.         End Select
  732.  
  733.         Dim radRec As New Rectangle(0, 0, Height - 1, Height - 1)
  734.         Dim B1 As New LinearGradientBrush(New Point(radRec.X + radRec.Width / 2, radRec.Y), New Point(radRec.X + radRec.Width / 2, radRec.Y + radRec.Height), C2, C3)
  735.         G.SmoothingMode = SmoothingMode.HighQuality
  736.         G.FillEllipse(B1, radRec)
  737.         G.DrawEllipse(New Pen(ToBrush(C1)), radRec)
  738.         If Checked Then G.FillEllipse(ToBrush(C4), New Rectangle(radRec.X + radRec.Width / 4, radRec.Y + radRec.Height / 4, radRec.Width / 2, radRec.Height / 2))
  739.         G.DrawString(Text, Font, ToBrush(C4), New Rectangle(radRec.X + radRec.Width + 5, 0, Width - radRec.X - radRec.Width - 5, Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  740.  
  741.  
  742.         e.Graphics.DrawImage(B, 0, 0)
  743.         G.Dispose() : B.Dispose()
  744.     End Sub
  745.  
  746.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  747.         If Enabled Then : State = MouseState.None : If Not Checked Then : Checked = True : End If : End If
  748.     End Sub
  749.  
  750.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  751.         If Not Enabled Then State = MouseState.Down
  752.     End Sub
  753. End Class
  754.  
  755. Public Class SkyDarkItem
  756.  
  757.     Private _text As String
  758.     Public Property Text() As String
  759.         Get
  760.             Return _text
  761.         End Get
  762.         Set(ByVal value As String)
  763.             _text = value
  764.         End Set
  765.     End Property
  766.  
  767. End Class
  768.  
  769. Public Class SkyDarkListBox
  770.     Inherits Control
  771.  
  772. #Region "Do Not Touch"
  773.     Private Offset% = 0
  774.     Private PrevY% = 0
  775.     Private Hovered% = -1
  776.     Private NotScrolled As Boolean = True
  777.     Private WithEvents T As Timer = New Timer With {.Interval = 10}
  778.     Public Event ItemClicked(ByVal Itm As SkyDarkItem)
  779.  
  780.     Private Function RoundedRectangle(ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal Roundness As Integer) As GraphicsPath
  781.         Dim Temp As GraphicsPath = New GraphicsPath
  782.         With Temp
  783.             .AddArc(X, Y, Roundness, Roundness, -180, 90)
  784.             .AddArc(X + Width - Roundness, Y, Roundness, Roundness, -90, 90)
  785.             .AddArc(X + Width - Roundness, Y + Height - Roundness, Roundness, Roundness, 0, 90)
  786.             .AddArc(X, Y + Height - Roundness, Roundness, Roundness, 90, 90)
  787.             .CloseFigure()
  788.         End With
  789.         Return Temp
  790.     End Function
  791.  
  792.     Private Function RoundedRectangle(ByVal Rect As Rectangle, ByVal Roundness As Integer)
  793.         Return RoundedRectangle(Rect.X, Rect.Y, Rect.Width, Rect.Height, Roundness)
  794.     End Function
  795. #End Region
  796.  
  797. #Region "Properties"
  798.  
  799.     Private _items As SkyDarkItem()
  800.     Public Property Items() As SkyDarkItem()
  801.         Get
  802.             Return _items
  803.         End Get
  804.         Set(ByVal value As SkyDarkItem())
  805.             _items = value
  806.             Invalidate()
  807.         End Set
  808.     End Property
  809.  
  810.     Private _itemSize As Integer
  811.     Public Property ItemSize() As Integer
  812.         Get
  813.             Return _itemSize
  814.         End Get
  815.         Set(ByVal value As Integer)
  816.             If value > 1 Then
  817.                 _itemSize = value
  818.             Else
  819.                 _itemSize = 2
  820.             End If
  821.             Invalidate()
  822.         End Set
  823.     End Property
  824.  
  825.     Private _itemSpacing As Integer
  826.     Public Property ItemSpacing() As Integer
  827.         Get
  828.             Return _itemSpacing
  829.         End Get
  830.         Set(ByVal value As Integer)
  831.             _itemSpacing = value
  832.             Invalidate()
  833.         End Set
  834.     End Property
  835.  
  836. #End Region
  837.  
  838.     Sub New()
  839.         SetStyle(ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor Or 16, True)
  840.         BackColor = Color.Transparent
  841.         T.Start()
  842.     End Sub
  843.  
  844.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  845.         Dim G As Graphics = e.Graphics : G.SmoothingMode = SmoothingMode.AntiAlias
  846.         Dim Back As Color = Color.FromArgb(52, 50, 48)
  847.  
  848.         G.FillPath(New SolidBrush(Back), RoundedRectangle(0, 0, Width - 1, Height - 1, 5))
  849.  
  850.         G.Clip = New Region(RoundedRectangle(0, 0, Width - 1, Height - 1, 5))
  851.         If Not _items Is Nothing Then
  852.             For i = 0 To _items.Count - 1
  853.                 Dim DrawRect As Rectangle = New Rectangle(3, 3 + (i * ItemSize) + (i * ItemSpacing) + Offset, Width - 7, ItemSize)
  854.                 Dim Hover% = 0
  855.                 If i = Hovered Then
  856.                     G.DrawString(_items(i).Text, Font, Brushes.SteelBlue, DrawRect, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  857.                     If MouseButtons = Windows.Forms.MouseButtons.Left And NotScrolled Then
  858.                         Hover = -5
  859.                     Else
  860.                         Hover = 5
  861.                     End If
  862.                 Else
  863.                     G.DrawString(_items(i).Text, Font, Brushes.Gray, DrawRect, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  864.                 End If
  865.                 Dim Divide As LinearGradientBrush = New LinearGradientBrush(New Point(DrawRect.X, 0), New Point(DrawRect.X + DrawRect.Width, 0), Nothing, Nothing)
  866.                 Divide.InterpolationColors = New ColorBlend With {.Colors = New Color() {Color.Transparent, Color.FromArgb(60, Color.White), Color.Transparent}, .Positions = New Single() {0, 0.5, 1}}
  867.  
  868.                 G.FillRectangle(New LinearGradientBrush(New Point(0, DrawRect.Y), New Point(0, DrawRect.Y + DrawRect.Height), Color.FromArgb(10 + Hover, Color.White), Color.Transparent), DrawRect)
  869.                 G.DrawLine(New Pen(Divide), New Point(DrawRect.X, DrawRect.Y), New Point(DrawRect.X + DrawRect.Width, DrawRect.Y))
  870.                 G.DrawLine(New Pen(Divide), New Point(DrawRect.X, DrawRect.Y + DrawRect.Height), New Point(DrawRect.X + DrawRect.Width, DrawRect.Y + DrawRect.Height))
  871.                 Divide.Dispose()
  872.             Next
  873.         End If
  874.  
  875.         G.FillRectangle(New LinearGradientBrush(New Point(0, 0), New Point(0, 21), Back, Color.Transparent), 0, 0, Width, 20)
  876.         G.FillRectangle(New LinearGradientBrush(New Point(0, Height - 20), New Point(0, Height), Color.Transparent, Back), 0, Height - 20, Width, 20)
  877.         G.Clip = New Region(New Rectangle(0, 0, Width, Height))
  878.         G.DrawPath(New Pen(New SolidBrush(Color.FromArgb(70, 70, 70))), RoundedRectangle(0, 0, Width - 1, Height - 1, 5))
  879.     End Sub
  880.  
  881.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  882.         If e.Button = Windows.Forms.MouseButtons.Left Then
  883.             Offset -= PrevY - PointToClient(MousePosition).Y
  884.             PrevY = PointToClient(MousePosition).Y
  885.             Invalidate()
  886.         End If
  887.  
  888.         If Not _items Is Nothing Then
  889.             For i = 0 To _items.Count - 1
  890.                 If New Rectangle(3, 3 + (i * ItemSize) + (i * ItemSpacing) + Offset, Width - 7, ItemSize).Contains(PointToClient(MousePosition)) Then
  891.                     Hovered = i
  892.                     Invalidate()
  893.                 End If
  894.             Next
  895.         End If
  896.  
  897.         NotScrolled = False
  898.     End Sub
  899.  
  900.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  901.         PrevY = PointToClient(MousePosition).Y
  902.         NotScrolled = True
  903.         Invalidate()
  904.     End Sub
  905.  
  906.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  907.         If NotScrolled And Not _items Is Nothing Then
  908.             For i = 0 To _items.Count - 1
  909.                 If New Rectangle(3, 3 + (i * ItemSize) + (i * ItemSpacing) + Offset, Width - 7, ItemSize).Contains(PointToClient(MousePosition)) Then
  910.                     RaiseEvent ItemClicked(Items(i))
  911.                     Exit For
  912.                 End If
  913.             Next
  914.         End If
  915.     End Sub
  916.  
  917.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  918.         Hovered = -1
  919.         Invalidate()
  920.     End Sub
  921.  
  922.     Private Sub ScrollCheck() Handles T.Tick
  923.         If Not MouseButtons = Windows.Forms.MouseButtons.Left And Not _items Is Nothing Then
  924.             If Offset > 0 Then
  925.                 Offset -= Math.Ceiling(Offset / 10)
  926.                 Invalidate()
  927.             ElseIf Offset < 0 And (_items.Count * ItemSize) + ((_items.Count - 1) * ItemSpacing) < Height Then
  928.                 Offset -= Math.Ceiling(Offset / 10) - 1
  929.                 Invalidate()
  930.             ElseIf Offset + (_items.Count * ItemSize) + ((_items.Count - 1) * ItemSpacing) < Height And (_items.Count * ItemSize) + ((_items.Count - 1) * ItemSpacing) > Height Then
  931.                 Dim px% = Offset + (_items.Count * ItemSize) + ((_items.Count - 1) * ItemSpacing)
  932.                 Offset += (Height - px) / 10
  933.                 Invalidate()
  934.             End If
  935.         End If
  936.     End Sub
  937.  
  938.     Public Sub AddItem(ByVal Text As String)
  939.         Dim nItems As List(Of SkyDarkItem) = New List(Of SkyDarkItem)
  940.         nItems.AddRange(Items)
  941.         nItems.Add(New SkyDarkItem() With {.Text = Text})
  942.  
  943.         Items = nItems.ToArray
  944.     End Sub
  945.  
  946.     Public Sub RemoveItem(ByVal Text As String)
  947.         Dim nItems As List(Of SkyDarkItem) = New List(Of SkyDarkItem)
  948.         nItems.AddRange(Items)
  949.  
  950.         For i = 0 To nItems.Count - 1
  951.             If nItems(i).Text = Text Then
  952.                 nItems.RemoveAt(i)
  953.                 Exit For
  954.             End If
  955.         Next
  956.  
  957.         Items = nItems.ToArray
  958.     End Sub
  959. End Class
Add Comment
Please, Sign In to add comment