Advertisement
Finessed

Sky Base Theme

Dec 2nd, 2015
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 29.84 KB | None | 0 0
  1. Imports System.Drawing.Drawing2D
  2.  
  3. ' Get more free themes at ThemesVB.NET
  4.  
  5. Module ConversionFunctions
  6.     Function ToBrush(ByVal A As Integer, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Brush
  7.         Return New SolidBrush(Color.FromArgb(A, R, G, B))
  8.     End Function
  9.     Function ToBrush(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Brush
  10.         Return New SolidBrush(Color.FromArgb(R, G, B))
  11.     End Function
  12.     Function ToBrush(ByVal A As Integer, ByVal C As Color) As Brush
  13.         Return New SolidBrush(Color.FromArgb(A, C))
  14.     End Function
  15.     Function ToBrush(ByVal Pen As Pen) As Brush
  16.         Return New SolidBrush(Pen.Color)
  17.     End Function
  18.     Function ToBrush(ByVal Color As Color) As Brush
  19.         Return New SolidBrush(Color)
  20.     End Function
  21.     Function ToPen(ByVal A As Integer, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Pen
  22.         Return New Pen(New SolidBrush(Color.FromArgb(A, R, G, B)))
  23.     End Function
  24.     Function ToPen(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Pen
  25.         Return New Pen(New SolidBrush(Color.FromArgb(R, G, B)))
  26.     End Function
  27.     Function ToPen(ByVal A As Integer, ByVal C As Color) As Pen
  28.         Return New Pen(New SolidBrush(Color.FromArgb(A, C)))
  29.     End Function
  30.     Function ToPen(ByVal Brush As SolidBrush) As Pen
  31.         Return New Pen(Brush)
  32.     End Function
  33.     Function ToPen(ByVal Color As Color) As Pen
  34.         Return New Pen(New SolidBrush(Color))
  35.     End Function
  36. End Module
  37. ' Get more free themes at ThemesVB.NET
  38. Module RRM
  39.     Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  40.         Dim P As GraphicsPath = New GraphicsPath()
  41.         Dim ArcRectangleWidth As Integer = Curve * 2
  42.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  43.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  44.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  45.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  46.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  47.         Return P
  48.     End Function
  49.     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
  50.         Dim Rectangle As Rectangle = New Rectangle(X, Y, Width, Height)
  51.         Dim P As GraphicsPath = New GraphicsPath()
  52.         Dim ArcRectangleWidth As Integer = Curve * 2
  53.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  54.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  55.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  56.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  57.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  58.         Return P
  59.     End Function
  60. End Module
  61.  
  62. Module Shapes
  63.     Public Function Triangle(ByVal Location As Point, ByVal Size As Size) As Point()
  64.         Dim ReturnPoints(0 To 3) As Point
  65.         ReturnPoints(0) = Location
  66.         ReturnPoints(1) = New Point(Location.X + Size.Width, Location.Y)
  67.         ReturnPoints(2) = New Point(Location.X + Size.Width \ 2, Location.Y + Size.Height)
  68.         ReturnPoints(3) = Location
  69.  
  70.         Return ReturnPoints
  71.     End Function
  72. End Module
  73. ' Get more free themes at ThemesVB.NET
  74. Public Class SkyDarkForm
  75.     Inherits ContainerControl
  76.     Dim WithEvents Maxim As SkyDarkTop
  77.     Dim WithEvents Exim As SkyDarkTop
  78.     Private Locked As Boolean = False
  79.     Private Locked1 As Point = Nothing
  80.  
  81.     Sub New()
  82.         Dock = DockStyle.Fill
  83.         SendToBack()
  84.         BackColor = Color.FromArgb(62, 60, 58)
  85.     End Sub
  86.  
  87.     Protected Overrides Sub OnHandleCreated(ByVal e As System.EventArgs)
  88.         Parent.FindForm.FormBorderStyle = FormBorderStyle.None
  89.         Maxim = New SkyDarkTop With {.Location = New Point(Width - 41, 3), .Size = New Size(14, 14), .Parent = Me}
  90.         Exim = New SkyDarkTop With {.Location = New Point(Width - 22, 3), .Size = New Size(14, 14), .Parent = Me}
  91.         Me.Controls.Add(Maxim)
  92.         Me.Controls.Add(Exim)
  93.         Maxim.Show()
  94.         Exim.Show()
  95.     End Sub
  96.     Dim T1 As New Rectangle(1, 1, Width - 3, 18)
  97.     Dim C1 As Color = Color.FromArgb(62, 60, 58)
  98.     Dim C2 As Color = Color.FromArgb(81, 79, 77)
  99.     Dim C3 As Color = Color.FromArgb(71, 70, 69)
  100.     Dim C4 As Color = Color.FromArgb(58, 56, 54)
  101.  
  102.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  103.         Dim B As New Bitmap(Width, Height)
  104.         Dim G As Graphics = Graphics.FromImage(B)
  105.  
  106.         'Drawing
  107.         G.Clear(C1)
  108.         Dim G1 As New LinearGradientBrush(New Point(T1.X, T1.Y), New Point(T1.X, T1.Y + T1.Height), C3, C4)
  109.         G.FillRectangle(G1, T1)
  110.         G.DrawRectangle(ToPen(C2), T1)
  111.         G.DrawRectangle(ToPen(C2), New Rectangle(T1.X, T1.Y + T1.Height + 2, T1.Width, Height - T1.Y - T1.Height - 4))
  112.  
  113.         G1.Dispose()
  114.  
  115.         G.DrawString(Text, Font, ToBrush(113, 170, 186), _
  116.                      New Rectangle(New Point(T1.X + 4, T1.Y), New Size(T1.Width - 40, T1.Height)), _
  117.                      New StringFormat With {.LineAlignment = StringAlignment.Center})
  118.  
  119.  
  120.         'Finish Up
  121.         e.Graphics.DrawImage(B.Clone, 0, 0)
  122.         G.Dispose() : B.Dispose()
  123.     End Sub
  124.  
  125.     Private Sub Exim_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Exim.Click
  126.         Parent.FindForm.Close()
  127.     End Sub
  128.  
  129.     Private Sub Maxim_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Maxim.Click
  130.         Parent.FindForm.WindowState = FormWindowState.Minimized
  131.     End Sub
  132.  
  133.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  134.         MyBase.OnMouseUp(e) : Locked = False : Locked1 = Nothing
  135.     End Sub
  136.  
  137.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  138.         MyBase.OnMouseDown(e) : If T1.Contains(e.Location) Then : Locked = True : Locked1 = e.Location : End If
  139.     End Sub
  140.  
  141.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  142.         MyBase.OnMouseMove(e) : If Locked Then Parent.Location = Cursor.Position - Locked1
  143.     End Sub
  144.  
  145.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  146.         MyBase.OnResize(e) : T1 = New Rectangle(1, 1, Width - 3, 18)
  147.     End Sub
  148. End Class
  149.  
  150. Public Class SkyDarkButton
  151.     Inherits Control
  152.  
  153. #Region "Properties"
  154.     Public Overrides Property Text As String
  155.         Get
  156.             Return MyBase.Text
  157.         End Get
  158.         Set(ByVal value As String)
  159.             MyBase.Text = value
  160.             Invalidate()
  161.         End Set
  162.     End Property
  163. #End Region
  164.  
  165.     Sub New()
  166.         DoubleBuffered = True
  167.     End Sub
  168.  
  169.     Dim C1 As Color = Color.FromArgb(51, 49, 47)
  170.     Dim C2 As Color = Color.FromArgb(90, 91, 90)
  171.     Dim C3 As Color = Color.FromArgb(70, 71, 70)
  172.     Dim C4 As Color = Color.FromArgb(62, 61, 58)
  173.  
  174.  
  175.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  176.         Dim B As New Bitmap(Width, Height)
  177.         Dim G As Graphics = Graphics.FromImage(B)
  178.  
  179.         Dim G1 As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), C3, C4)
  180.         G.FillRectangle(G1, 0, 0, Width, Height)
  181.         G1.Dispose()
  182.  
  183.         If Enabled Then
  184.             Select Case State
  185.                 Case MouseState.Over
  186.                     G.FillRectangle(New SolidBrush(Color.FromArgb(20, Color.White)), New Rectangle(0, 0, Width, Height))
  187.                 Case MouseState.Down
  188.                     G.FillRectangle(New SolidBrush(Color.FromArgb(10, Color.Black)), New Rectangle(0, 0, Width, Height))
  189.             End Select
  190.         End If
  191.  
  192.         Dim S1 As New StringFormat
  193.         S1.LineAlignment = StringAlignment.Center
  194.         S1.Alignment = StringAlignment.Center
  195.  
  196.         Select Case Enabled
  197.             Case True
  198.                 G.DrawString(Text, Font, ToBrush(113, 170, 186), New Rectangle(0, 0, Width - 1, Height - 1), S1)
  199.             Case False
  200.                 G.DrawString(Text, Font, Brushes.Gray, New Rectangle(0, 0, Width - 1, Height - 1), S1)
  201.         End Select
  202.  
  203.         S1.Dispose()
  204.  
  205.         G.DrawRectangle(ToPen(C1), 0, 0, Width - 1, Height - 1)
  206.         G.DrawRectangle(ToPen(C2), 1, 1, Width - 3, Height - 3)
  207.  
  208.         e.Graphics.DrawImage(B.Clone, 0, 0)
  209.         G.Dispose() : B.Dispose()
  210.     End Sub
  211. ' Get more free themes at ThemesVB.NET
  212. #Region "Mouse States"
  213.     Enum MouseState
  214.         None
  215.         Over
  216.         Down
  217.     End Enum
  218.     Private ms As MouseState
  219.     Private Property State() As MouseState
  220.         Get
  221.             Return ms
  222.         End Get
  223.         Set(ByVal value As MouseState)
  224.             ms = value
  225.             Invalidate()
  226.         End Set
  227.     End Property
  228.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  229.         MyBase.OnMouseEnter(e) : State = MouseState.Over
  230.     End Sub
  231.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  232.         MyBase.OnMouseLeave(e) : State = MouseState.None
  233.     End Sub
  234.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  235.         MyBase.OnMouseDown(e) : State = MouseState.Down
  236.     End Sub
  237.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  238.         MyBase.OnMouseUp(e) : State = MouseState.Over
  239.     End Sub
  240. #End Region
  241. End Class
  242.  
  243. Public Class SkyDarkProgress
  244.     Inherits Control
  245.  
  246. #Region "Properties"
  247.     Private val As Integer
  248.     Public Property Value() As Integer
  249.         Get
  250.             Return val
  251.         End Get
  252.         Set(ByVal _value As Integer)
  253.             If _value > max Then
  254.                 val = max
  255.             ElseIf _value < 0 Then
  256.                 val = 0
  257.             Else
  258.                 val = _value
  259.             End If
  260.             Invalidate()
  261.         End Set
  262.     End Property
  263.     Private max As Integer
  264.     Public Property Maximum() As Integer
  265.         Get
  266.             Return max
  267.         End Get
  268.         Set(ByVal _value As Integer)
  269.             If _value < 1 Then
  270.                 max = 1
  271.             Else
  272.                 max = _value
  273.             End If
  274.  
  275.             If _value < val Then
  276.                 val = max
  277.             End If
  278.  
  279.             Invalidate()
  280.         End Set
  281.     End Property
  282. #End Region
  283.     Dim C1 As Color = Color.FromArgb(51, 49, 47)
  284.     Dim C2 As Color = Color.FromArgb(81, 77, 77)
  285.     Dim C3 As Color = Color.FromArgb(64, 60, 59)
  286.     Dim C4 As Color = Color.FromArgb(70, 71, 70)
  287.     Dim C5 As Color = Color.FromArgb(62, 59, 58)
  288.  
  289.     Sub New()
  290.         max = 100
  291.     End Sub
  292.  
  293.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  294.         Dim B As New Bitmap(Width, Height)
  295.         Dim G As Graphics = Graphics.FromImage(B)
  296.         Dim Fill As Rectangle = New Rectangle(3, 3, CInt((Width - 7) * (val / max)), Height - 7)
  297.  
  298.         G.Clear(C5)
  299.  
  300.         Dim G1 As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), C3, C4)
  301.         G.FillRectangle(G1, Fill)
  302.         G1.Dispose()
  303.         G.DrawRectangle(ToPen(C2), Fill)
  304.  
  305.         G.DrawRectangle(ToPen(C1), 0, 0, Width - 1, Height - 1)
  306.         G.DrawRectangle(ToPen(C2), 1, 1, Width - 3, Height - 3)
  307.  
  308.         e.Graphics.DrawImage(B.Clone, 0, 0)
  309.         G.Dispose() : B.Dispose()
  310.     End Sub
  311. End Class
  312. ' Get more free themes at ThemesVB.NET
  313. Public Class SkyDarkTabControl
  314.     Inherits TabControl
  315.  
  316.     Sub New()
  317.         SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  318.         ControlStyles.ResizeRedraw Or _
  319.         ControlStyles.UserPaint Or _
  320.         ControlStyles.DoubleBuffer, True)
  321.         DoubleBuffered = True
  322.     End Sub
  323.     Protected Overrides Sub CreateHandle()
  324.         MyBase.CreateHandle()
  325.         Alignment = TabAlignment.Top
  326.     End Sub
  327.     Dim C1 As Color = Color.FromArgb(62, 60, 58)
  328.     Dim C2 As Color = Color.FromArgb(80, 78, 76)
  329.     Dim C3 As Color = Color.FromArgb(51, 49, 47)
  330.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  331.         Dim B As New Bitmap(Width, Height)
  332.         Dim G As Graphics = Graphics.FromImage(B)
  333.         Try : SelectedTab.BackColor = C1 : Catch : End Try
  334.         G.Clear(Parent.BackColor)
  335.         For i = 0 To TabCount - 1
  336.             If Not i = SelectedIndex Then
  337.                 Dim x2 As Rectangle = New Rectangle(GetTabRect(i).X, GetTabRect(i).Y + 3, GetTabRect(i).Width + 2, GetTabRect(i).Height)
  338.                 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))
  339.                 G.FillRectangle(G1, x2) : G1.Dispose()
  340.                 G.DrawRectangle(ToPen(C3), x2)
  341.                 G.DrawRectangle(ToPen(C2), New Rectangle(x2.X + 1, x2.Y + 1, x2.Width - 2, x2.Height))
  342.                 G.DrawString(TabPages(i).Text, Font, ToBrush(130, 176, 190), x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  343.             End If
  344.         Next
  345.  
  346.         G.FillRectangle(ToBrush(C1), 0, ItemSize.Height, Width, Height)
  347.         G.DrawRectangle(ToPen(C2), 0, ItemSize.Height, Width - 1, Height - ItemSize.Height - 1)
  348.         G.DrawRectangle(ToPen(C3), 1, ItemSize.Height + 1, Width - 3, Height - ItemSize.Height - 3)
  349.         If Not SelectedIndex = -1 Then
  350.             Dim x1 As Rectangle = New Rectangle(GetTabRect(SelectedIndex).X - 2, GetTabRect(SelectedIndex).Y, GetTabRect(SelectedIndex).Width + 3, GetTabRect(SelectedIndex).Height)
  351.             G.FillRectangle(ToBrush(C1), New Rectangle(x1.X + 2, x1.Y + 2, x1.Width - 2, x1.Height))
  352.             G.DrawLine(ToPen(C2), New Point(x1.X, x1.Y + x1.Height - 2), New Point(x1.X, x1.Y))
  353.             G.DrawLine(ToPen(C2), New Point(x1.X, x1.Y), New Point(x1.X + x1.Width, x1.Y))
  354.             G.DrawLine(ToPen(C2), New Point(x1.X + x1.Width, x1.Y), New Point(x1.X + x1.Width, x1.Y + x1.Height - 2))
  355.  
  356.             G.DrawLine(ToPen(C3), New Point(x1.X + 1, x1.Y + x1.Height - 1), New Point(x1.X + 1, x1.Y + 1))
  357.             G.DrawLine(ToPen(C3), New Point(x1.X + 1, x1.Y + 1), New Point(x1.X + x1.Width - 1, x1.Y + 1))
  358.             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))
  359.  
  360.             G.DrawString(TabPages(SelectedIndex).Text, Font, ToBrush(130, 176, 190), x1, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  361.         End If
  362.  
  363.         e.Graphics.DrawImage(B.Clone, 0, 0)
  364.         G.Dispose() : B.Dispose()
  365.     End Sub
  366. End Class
  367.  
  368. Public Class SkyDarkCombo
  369.     Inherits ComboBox
  370.     Sub New()
  371.         MyBase.New()
  372.         SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  373.         ControlStyles.ResizeRedraw Or _
  374.         ControlStyles.UserPaint Or _
  375.         ControlStyles.DoubleBuffer, True)
  376.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  377.         BackColor = Color.FromArgb(235, 235, 235)
  378.         ForeColor = Color.FromArgb(31, 31, 31)
  379.         DropDownStyle = ComboBoxStyle.DropDownList
  380.     End Sub
  381.     Private _StartIndex As Integer = 0
  382.     Public Property StartIndex As Integer
  383.         Get
  384.             Return _StartIndex
  385.         End Get
  386.         Set(ByVal value As Integer)
  387.             _StartIndex = value
  388.             Try
  389.                 MyBase.SelectedIndex = value
  390.             Catch
  391.             End Try
  392.             Invalidate()
  393.         End Set
  394.     End Property
  395.  
  396.     Dim C1 As Color = Color.FromArgb(48, 48, 48)
  397.     Dim C2 As Color = Color.FromArgb(81, 79, 77)
  398.     Dim C3 As Color = Color.FromArgb(62, 60, 58)
  399.  
  400.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  401.         If Not DropDownStyle = ComboBoxStyle.DropDownList Then DropDownStyle = ComboBoxStyle.DropDownList
  402.         Dim B As New Bitmap(Width, Height)
  403.         Dim G As Graphics = Graphics.FromImage(B)
  404.  
  405.         G.Clear(C3)
  406.  
  407.  
  408.         Dim S1 As Integer = G.MeasureString("...", Font).Height
  409.         If SelectedIndex <> -1 Then
  410.  
  411.             G.DrawString(Items(SelectedIndex), Font, ToBrush(152, 182, 192), 4, Height \ 2 - S1 \ 2)
  412.         Else
  413.             If Not Items Is Nothing And Items.Count > 0 Then
  414.                 G.DrawString(Items(0), Font, ToBrush(152, 182, 192), 4, Height \ 2 - S1 \ 2)
  415.             Else
  416.                 G.DrawString("...", Font, ToBrush(152, 182, 192), 4, Height \ 2 - S1 \ 2)
  417.             End If
  418.         End If
  419.  
  420.         Dim G1 As New LinearGradientBrush(New Point(Width - 30, Height \ 2), New Point(Width - 22, Height \ 2), Color.Transparent, C3)
  421.         G.FillRectangle(G1, Width - 30, 0, 8, Height)
  422.  
  423.         G.DrawRectangle(ToPen(C1), New Rectangle(0, 0, Width - 1, Height - 1))
  424.         G.DrawLine(ToPen(C1), New Point(Width - 21, 0), New Point(Width - 21, Height))
  425.  
  426.         G.DrawRectangle(ToPen(C2), 1, 1, Width - 23, Height - 3)
  427.  
  428.         G.FillRectangle(ToBrush(C3), Width - 20, 1, 18, Height - 3)
  429.         G.FillRectangle(ToBrush(10, Color.White), Width - 20, 1, 18, Height - 3)
  430.         G.DrawRectangle(ToPen(C2), Width - 20, 1, 18, Height - 3)
  431.  
  432.         G.FillPolygon(Brushes.Black, Shapes.Triangle(New Point(Width - 12, Height \ 2), New Size(5, 3)))
  433.         G.FillPolygon(Brushes.LightBlue, Shapes.Triangle(New Point(Width - 13, Height \ 2 - 1), New Size(5, 3)))
  434.  
  435.         e.Graphics.DrawImage(B.Clone, 0, 0)
  436.         G.Dispose() : B.Dispose()
  437.     End Sub
  438.     Sub ReplaceItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  439.         Dim G As Graphics = e.Graphics
  440.         Dim C4 As Color = Color.Empty
  441.         e.DrawBackground()
  442.         Try
  443.             If e.State And DrawItemState.Selected = DrawItemState.Selected Then
  444.                 G.FillRectangle(ToBrush(50, 80, 120), New Rectangle(e.Bounds.X - 1, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height + 2))
  445.                 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))
  446.                 C4 = Color.FromArgb(100, 165, 185)
  447.             Else
  448.                 G.FillRectangle(ToBrush(62, 60, 58), New Rectangle(e.Bounds.X - 1, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height + 2))
  449.                 C4 = Color.FromArgb(200, 200, 200)
  450.             End If
  451.  
  452.             G.DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), e.Font, ToBrush(C4), e.Bounds, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  453.         Catch : End Try
  454.     End Sub
  455. ' Get more free themes at ThemesVB.NET
  456.     Private Sub SkyDarkCombo_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.TextChanged
  457.         Invalidate()
  458.     End Sub
  459. End Class
  460.  
  461. Public Class SkyDarkTop
  462.     Inherits Control
  463.  
  464.     Sub New()
  465.         DoubleBuffered = True
  466.         Size = New Size(10, 10)
  467.     End Sub
  468.     Dim C1 As Color = Color.FromArgb(94, 103, 106)
  469.     Dim C2 As Color = Color.FromArgb(152, 182, 192)
  470.     Dim CD As Color = Color.FromArgb(86, 94, 96)
  471.     Dim C3 As Color = Color.FromArgb(71, 70, 69)
  472.     Dim C4 As Color = Color.FromArgb(58, 56, 54)
  473.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  474.         Dim B As New Bitmap(Width, Height)
  475.         Dim G As Graphics = Graphics.FromImage(B)
  476.         Dim G1 As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), C3, C4)
  477.         G.FillRectangle(G1, ClientRectangle)
  478.         G1.Dispose()
  479.         G.SmoothingMode = SmoothingMode.HighQuality
  480.         Select Case State
  481.             Case MouseState.None
  482.                 G.DrawEllipse(New Pen(C1, 2), New Rectangle(2, 2, Width - 5, Height - 5))
  483.             Case MouseState.Over
  484.                 G.DrawEllipse(New Pen(C2, 2), New Rectangle(2, 2, Width - 5, Height - 5))
  485.             Case MouseState.Down
  486.                 G.DrawEllipse(New Pen(CD, 2), New Rectangle(2, 2, Width - 5, Height - 5))
  487.         End Select
  488.  
  489.         G.FillEllipse(ToBrush(C2), New Rectangle(5, 5, Width - 11, Height - 11))
  490.  
  491.         e.Graphics.DrawImage(B.Clone, 0, 0)
  492.         G.Dispose() : B.Dispose()
  493.     End Sub
  494.  
  495. #Region "Mouse States"
  496.     Enum MouseState
  497.         None
  498.         Over
  499.         Down
  500.     End Enum
  501.     Private ms As MouseState
  502.     Private Property State() As MouseState
  503.         Get
  504.             Return ms
  505.         End Get
  506.         Set(ByVal value As MouseState)
  507.             ms = value
  508.             Invalidate()
  509.         End Set
  510.     End Property
  511.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  512.         MyBase.OnMouseEnter(e) : State = MouseState.Over
  513.     End Sub
  514.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  515.         MyBase.OnMouseLeave(e) : State = MouseState.None
  516.     End Sub
  517.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  518.         MyBase.OnMouseDown(e) : State = MouseState.Down
  519.     End Sub
  520.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  521.         MyBase.OnMouseUp(e) : State = MouseState.Over
  522.     End Sub
  523. #End Region
  524. End Class
  525.  
  526. Public Class SkyDarkSeperator
  527.     Inherits Control
  528.  
  529.     Public Enum Alignment
  530.         Vertical
  531.         Horizontal
  532.     End Enum
  533.  
  534.     Private al As Alignment
  535.     Public Property Align() As Alignment
  536.         Get
  537.             Return al
  538.         End Get
  539.         Set(ByVal value As Alignment)
  540.             al = value
  541.             Invalidate()
  542.         End Set
  543.     End Property
  544.  
  545.     Dim C1 As Color = Color.FromArgb(51, 49, 47)
  546.     Dim C2 As Color = Color.FromArgb(90, 91, 90)
  547.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  548.         Dim B As New Bitmap(Width, Height)
  549.         Dim G As Graphics = Graphics.FromImage(B)
  550.  
  551.         Select Case Align
  552.             Case Alignment.Horizontal
  553.                 G.DrawLine(ToPen(C1), New Point(0, Height \ 2), New Point(Width, Height \ 2))
  554.                 G.DrawLine(ToPen(C2), New Point(0, Height \ 2 + 1), New Point(Width, Height \ 2 + 1))
  555.             Case Alignment.Vertical
  556.                 G.DrawLine(ToPen(C1), New Point(Width \ 2, 0), New Point(Width \ 2, Height))
  557.                 G.DrawLine(ToPen(C2), New Point(Width \ 2 + 1, 0), New Point(Width \ 2 + 1, Height))
  558.         End Select
  559.  
  560.         e.Graphics.DrawImage(B, 0, 0)
  561.         G.Dispose() : B.Dispose()
  562.     End Sub
  563. End Class
  564.  
  565. Public Class SkyDarkCheck
  566.     Inherits Control
  567.  
  568.     Enum MouseState
  569.         None
  570.         Down
  571.     End Enum
  572.  
  573. #Region "Properties"
  574.  
  575.     Private chk As Boolean
  576.     Public Property Checked() As Boolean
  577.         Get
  578.             Return chk
  579.         End Get
  580.         Set(ByVal value As Boolean)
  581.             chk = value
  582.             Invalidate()
  583.         End Set
  584.     End Property
  585.  
  586.     Private ms As MouseState
  587.     Public Property State() As MouseState
  588.         Get
  589.             Return ms
  590.         End Get
  591.         Set(ByVal value As MouseState)
  592.             ms = value
  593.             invalidate()
  594.         End Set
  595.     End Property
  596.  
  597. #End Region
  598.  
  599.     Dim C1 As Color = Color.FromArgb(51, 49, 47)
  600.     Dim C2 As Color = Color.FromArgb(80, 77, 77)
  601.  
  602.     Dim C3 As Color = Color.FromArgb(70, 69, 68)
  603.     Dim C4 As Color = Color.FromArgb(64, 60, 59)
  604.     Dim C5 As Color = Color.Transparent
  605.  
  606.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  607.         Dim B As New Bitmap(Width, Height)
  608.         Dim G As Graphics = Graphics.FromImage(B)
  609.  
  610.         G.Clear(Parent.BackColor)
  611.         C3 = Color.FromArgb(70, 69, 68)
  612.         C4 = Color.FromArgb(64, 60, 59)
  613.         Select Case Enabled
  614.             Case True
  615.                 Select Case State
  616.                     Case MouseState.Down
  617.                         C5 = Color.FromArgb(121, 151, 160)
  618.                         C3 = Color.FromArgb(64, 60, 59)
  619.                         C4 = Color.FromArgb(70, 69, 68)
  620.                     Case MouseState.None
  621.                         C5 = Color.FromArgb(151, 181, 190)
  622.                 End Select
  623.             Case False
  624.                 C5 = Color.FromArgb(88, 88, 88)
  625.         End Select
  626.  
  627.         Dim chkRec As New Rectangle(0, 0, Height - 1, Height - 1)
  628.         Dim G1 As New LinearGradientBrush(New Point(chkRec.X, chkRec.Y), New Point(chkRec.X, chkRec.Y + chkRec.Height), C3, C4)
  629.         G.FillRectangle(G1, chkRec) : G1.Dispose()
  630.         G.DrawRectangle(ToPen(C1), chkRec)
  631.         G.DrawRectangle(ToPen(C2), New Rectangle(chkRec.X + 1, chkRec.Y + 1, chkRec.Width - 2, chkRec.Height - 2))
  632.         Dim chkPoly As Rectangle = New Rectangle(chkRec.X + chkRec.Width / 4, chkRec.Y + chkRec.Height / 4, chkRec.Width \ 2, chkRec.Height \ 2)
  633.         Dim Poly() As Point = {New Point(chkPoly.X, chkPoly.Y + chkPoly.Height \ 2), _
  634.                        New Point(chkPoly.X + chkPoly.Width \ 2, chkPoly.Y + chkPoly.Height), _
  635.                        New Point(chkPoly.X + chkPoly.Width, chkPoly.Y)}
  636.         ' Get more free themes at ThemesVB.NET
  637.         If Checked Then
  638.             G.SmoothingMode = SmoothingMode.HighQuality
  639.             Dim P1 As New Pen(ToBrush(C5), 2)
  640.             For i = 0 To Poly.Length - 2
  641.                 G.DrawLine(P1, Poly(i), Poly(i + 1))
  642.             Next
  643.         End If
  644.         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})
  645.  
  646.         e.Graphics.DrawImage(B, 0, 0)
  647.         G.Dispose() : B.Dispose()
  648.     End Sub
  649.  
  650.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  651.         If Enabled Then : State = MouseState.None : Checked = Not Checked : End If
  652.     End Sub
  653.  
  654.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  655.         If Enabled Then : State = MouseState.Down : End If
  656.     End Sub
  657. End Class
  658.  
  659. Public Class SkyDarkRadio
  660.     Inherits Control
  661.  
  662.     Enum MouseState
  663.         None
  664.         Down
  665.     End Enum
  666.  
  667. #Region "Properties"
  668.  
  669.     Private ms As MouseState
  670.     Public Property State() As MouseState
  671.         Get
  672.             Return ms
  673.         End Get
  674.         Set(ByVal value As MouseState)
  675.             ms = value
  676.             Invalidate()
  677.         End Set
  678.     End Property
  679.  
  680.     Private chk As Boolean
  681.     Public Property Checked() As Boolean
  682.         Get
  683.             Return chk
  684.         End Get
  685.         Set(ByVal value As Boolean)
  686.             chk = value
  687.             Invalidate()
  688.             ''Error code: Whenever I add this it overflows like an infinite loop...
  689.             Try
  690.                 If value Then
  691.                     For Each ctl In Parent.Controls
  692.                         If TypeOf ctl Is SkyDarkRadio Then
  693.                             If Not ctl Is Me And DirectCast(ctl, SkyDarkRadio).Enabled Then
  694.                                 DirectCast(ctl, SkyDarkRadio).Checked = False
  695.                             End If
  696.                         End If
  697.                     Next
  698.                 End If
  699.             Catch : End Try
  700.         End Set
  701.     End Property
  702.  
  703. #End Region
  704.  
  705.     Sub New()
  706.         Size = New Size(Width, 13)
  707.     End Sub
  708.  
  709.     Dim C1 As Color = Color.FromArgb(35, 35, 35)
  710.     Dim C2 As Color = Color.Transparent
  711.     Dim C3 As Color = Color.Transparent
  712.     Dim C4 As Color = Color.Transparent
  713.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  714.         Dim B As New Bitmap(Width, Height)
  715.         Dim G As Graphics = Graphics.FromImage(B)
  716.  
  717.         G.Clear(Parent.BackColor)
  718.  
  719.         Select Case Enabled
  720.             Case True
  721.                 Select Case State
  722.                     Case MouseState.None
  723.                         C2 = Color.FromArgb(70, 70, 70)
  724.                         C3 = Color.FromArgb(54, 54, 51)
  725.                         C4 = Color.FromArgb(152, 182, 192)
  726.                     Case MouseState.Down
  727.                         C2 = Color.FromArgb(54, 54, 51)
  728.                         C3 = Color.FromArgb(70, 70, 70)
  729.                         C4 = Color.FromArgb(112, 142, 152)
  730.                 End Select
  731.             Case False
  732.                 C2 = Color.FromArgb(70, 70, 70)
  733.                 C3 = Color.FromArgb(54, 54, 51)
  734.                 C4 = Color.FromArgb(89, 88, 88)
  735.         End Select
  736. ' Get more free themes at ThemesVB.NET
  737.         Dim radRec As New Rectangle(0, 0, Height - 1, Height - 1)
  738.         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)
  739.         G.SmoothingMode = SmoothingMode.HighQuality
  740.         G.FillEllipse(B1, radRec)
  741.         G.DrawEllipse(New Pen(ToBrush(C1)), radRec)
  742.         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))
  743.         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})
  744.  
  745.  
  746.         e.Graphics.DrawImage(B, 0, 0)
  747.         G.Dispose() : B.Dispose()
  748.     End Sub
  749.  
  750.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  751.         If Enabled Then : State = MouseState.None : If Not Checked Then : Checked = True : End If : End If
  752.     End Sub
  753.  
  754.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  755.         If Not Enabled Then State = MouseState.Down
  756.     End Sub
  757. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement