SaketSaket

Glow Theme HF

Aug 6th, 2014
1,139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 50.05 KB | None | 0 0
  1. Option Strict On
  2.  
  3. '<info>
  4. ' --------------------Glow Theme--------------------
  5. ' Creator - SaketSaket (HF)
  6. ' UID - 1869668
  7. ' Inspiration & Credits to all Theme creaters of HF
  8. ' Version - 1.0
  9. ' Date Created - 1st August 2014
  10. ' Date Modified - 4th August 2014
  11. '
  12. '
  13. 'Special Thanks to Aeonhack for RoundRect Functions...
  14. 'Credits to Mephobia for InnerGlow Function...
  15. '
  16. '
  17. ' For bugs & Constructive Criticism contact me on HF
  18. ' If you like it & want to donate then pm me on HF
  19. ' --------------------Glow Theme--------------------
  20. '<info>
  21.  
  22. 'Please Leave Credits in Source, Do not redistribute
  23.  
  24. Imports System.Drawing.Drawing2D
  25.  
  26. Enum MouseState As Byte
  27.     None = 0
  28.     Over = 1
  29.     Down = 2
  30. End Enum
  31.  
  32. Module Draw
  33.     'Special Thanks to Aeonhack for RoundRect Functions... ;)
  34.     Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
  35.         Dim p As GraphicsPath = New GraphicsPath()
  36.         Dim arcRectangleWidth As Integer = curve * 2
  37.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  38.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  39.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  40.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  41.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  42.         Return p
  43.     End Function
  44.     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
  45.         Dim rectangle As Rectangle = New Rectangle(x, y, width, height)
  46.         Dim p As GraphicsPath = New GraphicsPath()
  47.         Dim arcRectangleWidth As Integer = curve * 2
  48.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  49.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  50.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  51.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  52.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  53.         Return p
  54.     End Function
  55.  
  56.     'Special Thanks to Mephobia for InnerGlow Function... ;)
  57.     Public Sub InnerGlow(ByVal g As Graphics, ByVal rectangle As Rectangle, ByVal colour As Color())
  58.         Dim subtractTwo As Integer = 1
  59.         Dim addOne As Integer = 0
  60.         For Each c In colour
  61.             g.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(c.R, c.B, c.G))), rectangle.X + addOne, rectangle.Y + addOne, rectangle.Width - subtractTwo, rectangle.Height - subtractTwo)
  62.             subtractTwo += 2
  63.             addOne += 1
  64.         Next
  65.     End Sub
  66. End Module
  67.  
  68. Public Class GlowTheme : Inherits ContainerControl
  69.     Private _mousepos As Point = New Point(0, 0)
  70.     Private _drag As Boolean = False
  71.     Private _icon As Icon
  72.     Public Property Icon() As Icon
  73.         Get
  74.             Return _icon
  75.         End Get
  76.         Set(ByVal value As Icon)
  77.             _icon = value
  78.             Invalidate()
  79.         End Set
  80.     End Property
  81.  
  82.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  83.         MyBase.OnMouseDown(e)
  84.         If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(7, 7, Width - 125, 40).Contains(e.Location) Then
  85.             _drag = True : _mousepos = e.Location
  86.         End If
  87.     End Sub
  88.  
  89.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  90.         MyBase.OnMouseUp(e)
  91.         _drag = False
  92.     End Sub
  93.  
  94.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  95.         MyBase.OnMouseMove(e)
  96.         If _drag Then
  97.             Parent.Location = New Point(MousePosition.X - _mousepos.X, MousePosition.Y - _mousepos.Y)
  98.         End If
  99.     End Sub
  100.  
  101.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  102.         MyBase.OnResize(e)
  103.         Invalidate()
  104.     End Sub
  105.  
  106.     Sub New()
  107.         MyBase.New()
  108.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  109.         BackColor = Color.FromArgb(32, 32, 32)
  110.         DoubleBuffered = True
  111.     End Sub
  112.  
  113.     Protected Overrides Sub OnCreateControl()
  114.         MyBase.OnCreateControl()
  115.         ParentForm.FormBorderStyle = FormBorderStyle.None
  116.         ParentForm.TransparencyKey = Color.Fuchsia
  117.         Dock = DockStyle.Fill
  118.     End Sub
  119.  
  120.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  121.         Dim b As Bitmap = New Bitmap(Width, Height)
  122.         Dim g As Graphics = Graphics.FromImage(b)
  123.         Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  124.         Dim innerrect As Rectangle = New Rectangle(7, 52, Width - 15, Height - 60)
  125.         Dim leftheaderrect As Rectangle = New Rectangle(7, 7, Width - 125, 40)
  126.         Dim rightheaderrect As Rectangle = New Rectangle(Width - 101, 7, 93, 40)
  127.         MyBase.OnPaint(e)
  128.         g.Clear(Color.Fuchsia)
  129.         Dim orb As New LinearGradientBrush(outerrect, Color.FromArgb(63, 70, 88), Color.FromArgb(40, 42, 55), 90S)
  130.         g.FillPath(orb, RoundRect(outerrect, 5))
  131.         g.DrawPath(New Pen(Brushes.Black), RoundRect(outerrect, 5))
  132.         Dim irb As New LinearGradientBrush(innerrect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), 90S)
  133.         g.FillPath(irb, RoundRect(innerrect, 7))
  134.         g.DrawPath(New Pen(Brushes.Black), RoundRect(innerrect, 7))
  135.         Dim lhrb As New LinearGradientBrush(leftheaderrect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), 90S)
  136.         g.FillPath(lhrb, RoundRect(leftheaderrect, 7))
  137.         g.DrawPath(New Pen(Brushes.Black), RoundRect(leftheaderrect, 7))
  138.         Dim rhrb As New LinearGradientBrush(rightheaderrect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), 90S)
  139.         g.FillPath(rhrb, RoundRect(rightheaderrect, 7))
  140.         g.DrawPath(New Pen(Brushes.Black), RoundRect(rightheaderrect, 7))
  141.         Try
  142.             g.DrawIcon(_icon, New Rectangle(15, 15, 26, 26))
  143.         Catch : End Try
  144.         Dim htgb As New LinearGradientBrush(leftheaderrect, Color.FromArgb(12, 12, 12), Color.FromArgb(112, 112, 112), LinearGradientMode.Vertical)
  145.         g.DrawString(Text, New Font("Verdana", 15, FontStyle.Bold), htgb, leftheaderrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  146.         e.Graphics.DrawImage(b, New Point(0, 0))
  147.         g.Dispose() : b.Dispose()
  148.     End Sub
  149. End Class
  150.  
  151. Public Class GlowControlBox : Inherits Control
  152.     Dim _state As MouseState = MouseState.None
  153.     Dim _x As Integer
  154.     ReadOnly _minrect As New Rectangle(5, 2, 24, 24)
  155.     ReadOnly _maxrect As New Rectangle(32, 2, 24, 24)
  156.     ReadOnly _closerect As New Rectangle(59, 2, 24, 24)
  157.     Private _minDisable As Boolean = False
  158.     Public Property MinimumDisable As Boolean
  159.         Get
  160.             Return _minDisable
  161.         End Get
  162.         Set(value As Boolean)
  163.             _minDisable = value
  164.             Invalidate()
  165.         End Set
  166.     End Property
  167.  
  168.     Private _maxDisable As Boolean = False
  169.     Public Property MaximumDisable As Boolean
  170.         Get
  171.             Return _maxDisable
  172.         End Get
  173.         Set(value As Boolean)
  174.             _maxDisable = value
  175.             Invalidate()
  176.         End Set
  177.     End Property
  178.  
  179.     Protected Overrides Sub OnMouseDown(ByVal e As Windows.Forms.MouseEventArgs)
  180.         MyBase.OnMouseDown(e)
  181.         If _x > 5 AndAlso _x < 29 Then
  182.             If MinimumDisable = False Then
  183.                 FindForm.WindowState = FormWindowState.Minimized
  184.             End If
  185.         ElseIf _x > 32 AndAlso _x < 56 Then
  186.             If MaximumDisable = False Then
  187.                 If FindForm.WindowState = FormWindowState.Maximized Then
  188.                     FindForm.WindowState = FormWindowState.Minimized
  189.                     FindForm.WindowState = FormWindowState.Normal
  190.                 Else
  191.                     FindForm.WindowState = FormWindowState.Minimized
  192.                     FindForm.WindowState = FormWindowState.Maximized
  193.                 End If
  194.             End If
  195.         ElseIf _x > 59 AndAlso _x < 83 Then
  196.             FindForm.Close()
  197.         End If
  198.         _state = MouseState.Down : Invalidate()
  199.     End Sub
  200.  
  201.     Protected Overrides Sub OnMouseUp(ByVal e As Windows.Forms.MouseEventArgs)
  202.         MyBase.OnMouseUp(e)
  203.         _state = MouseState.Over : Invalidate()
  204.     End Sub
  205.  
  206.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  207.         MyBase.OnMouseEnter(e)
  208.         _state = MouseState.Over : Invalidate()
  209.     End Sub
  210.  
  211.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  212.         MyBase.OnMouseLeave(e)
  213.         _state = MouseState.None : Invalidate()
  214.     End Sub
  215.  
  216.     Protected Overrides Sub OnMouseMove(ByVal e As Windows.Forms.MouseEventArgs)
  217.         MyBase.OnMouseMove(e)
  218.         _x = e.Location.X
  219.         Invalidate()
  220.     End Sub
  221.  
  222.     Sub New()
  223.         MyBase.New()
  224.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  225.         DoubleBuffered = True
  226.         BackColor = Color.Transparent
  227.         Width = 85
  228.         Height = 30
  229.         Anchor = AnchorStyles.Top Or AnchorStyles.Right
  230.     End Sub
  231.  
  232.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  233.         Dim g As Graphics = e.Graphics
  234.         MyBase.OnPaint(e)
  235.         g.SmoothingMode = SmoothingMode.HighQuality
  236.         'Dim minrdefault As New LinearGradientBrush(_minrect, Color.FromArgb(121, 121, 119), Color.FromArgb(221, 221, 219), 90S)
  237.         'g.FillEllipse(minrdefault, _minrect)
  238.         'g.DrawEllipse(Pens.Black, _minrect)
  239.         'Dim maxrdefault As New LinearGradientBrush(_maxrect, Color.FromArgb(121, 121, 119), Color.FromArgb(221, 221, 219), 90S)
  240.         'g.FillEllipse(maxrdefault, _maxrect)
  241.         'g.DrawEllipse(Pens.Black, _maxrect)
  242.         'Dim crdefault As New LinearGradientBrush(_closerect, Color.FromArgb(121, 121, 119), Color.FromArgb(221, 221, 219), 90S)
  243.         'g.FillEllipse(crdefault, _closerect)
  244.         'g.DrawEllipse(Pens.Black, _closerect)
  245.         Select Case _state
  246.             Case MouseState.None
  247.                 Dim minrnone As New LinearGradientBrush(_minrect, Color.FromArgb(121, 121, 119), Color.FromArgb(221, 221, 219), 90S)
  248.                 g.FillEllipse(minrnone, _minrect)
  249.                 g.DrawEllipse(Pens.Black, _minrect)
  250.                 Dim maxrnone As New LinearGradientBrush(_maxrect, Color.FromArgb(121, 121, 119), Color.FromArgb(221, 221, 219), 90S)
  251.                 g.FillEllipse(maxrnone, _maxrect)
  252.                 g.DrawEllipse(Pens.Black, _maxrect)
  253.                 Dim crnone As New LinearGradientBrush(_closerect, Color.FromArgb(121, 121, 119), Color.FromArgb(221, 221, 219), 90S)
  254.                 g.FillEllipse(crnone, _closerect)
  255.                 g.DrawEllipse(Pens.Black, _closerect)
  256.             Case MouseState.Over
  257.                 If _x > 5 AndAlso _x < 29 Then
  258.                     If MinimumDisable = False Then
  259.                         Dim minrover As New LinearGradientBrush(_minrect, Color.FromArgb(93, 100, 118), Color.FromArgb(70, 72, 85), 90S)
  260.                         g.FillEllipse(minrover, _minrect)
  261.                         g.DrawEllipse(Pens.DimGray, _minrect)
  262.                     End If
  263.                 ElseIf _x > 32 AndAlso _x < 56 Then
  264.                     If MaximumDisable = False Then
  265.                         Dim maxrover As New LinearGradientBrush(_maxrect, Color.FromArgb(93, 100, 118), Color.FromArgb(70, 72, 85), 90S)
  266.                         g.FillEllipse(maxrover, _maxrect)
  267.                         g.DrawEllipse(Pens.DimGray, _maxrect)
  268.                     End If
  269.                 ElseIf _x > 59 AndAlso _x < 83 Then
  270.                     Dim crover As New LinearGradientBrush(_closerect, Color.FromArgb(93, 100, 118), Color.FromArgb(70, 72, 85), 90S)
  271.                     g.FillEllipse(crover, _closerect)
  272.                     g.DrawEllipse(Pens.DimGray, _closerect)
  273.                 End If
  274.             Case Else
  275.                 If MinimumDisable = False Then
  276.                     Dim minrelse As New LinearGradientBrush(_minrect, Color.FromArgb(123, 130, 148), Color.FromArgb(100, 102, 115), 90S)
  277.                     g.FillEllipse(minrelse, _minrect)
  278.                     g.DrawEllipse(Pens.DimGray, _minrect)
  279.                 End If
  280.                 If MaximumDisable = False Then
  281.                     Dim maxrelse As New LinearGradientBrush(_maxrect, Color.FromArgb(123, 130, 148), Color.FromArgb(100, 102, 115), 90S)
  282.                     g.FillEllipse(maxrelse, _maxrect)
  283.                     g.DrawEllipse(Pens.DimGray, _maxrect)
  284.                 End If
  285.                 Dim crelse As New LinearGradientBrush(_closerect, Color.FromArgb(123, 130, 148), Color.FromArgb(100, 102, 115), 90S)
  286.                 g.FillEllipse(crelse, _closerect)
  287.                 g.DrawEllipse(Pens.DimGray, _closerect)
  288.         End Select
  289.     End Sub
  290. End Class
  291.  
  292. Public Class GlowRadioButton : Inherits Control
  293.     Private _check As Boolean
  294.     Public Property Checked As Boolean
  295.         Get
  296.             Return _check
  297.         End Get
  298.         Set(value As Boolean)
  299.             _check = value
  300.             Invalidate()
  301.         End Set
  302.     End Property
  303.  
  304.     Sub New()
  305.         MyBase.New()
  306.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  307.         BackColor = Color.Transparent
  308.         DoubleBuffered = True
  309.         Size = New Size(180, 25)
  310.     End Sub
  311.  
  312.     Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  313.         MyBase.OnTextChanged(e)
  314.         Invalidate()
  315.     End Sub
  316.  
  317.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  318.         MyBase.OnClick(e)
  319.         If Not Checked Then Checked = True
  320.         For Each ctrl As GlowRadioButton In From ctrl1 In Parent.Controls.OfType(Of GlowRadioButton)() Where ctrl1.Handle <> Handle Where ctrl1.Enabled
  321.             ctrl.Checked = False
  322.         Next
  323.     End Sub
  324.  
  325.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  326.         Dim b As Bitmap = New Bitmap(Width, Height)
  327.         Dim g As Graphics = Graphics.FromImage(b)
  328.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  329.         Dim selectionrect As Rectangle = New Rectangle(5, 5, 12, 12)
  330.         Dim gb As New LinearGradientBrush(selectionrect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), LinearGradientMode.Vertical)
  331.         MyBase.OnPaint(e)
  332.         g.SmoothingMode = SmoothingMode.HighQuality
  333.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  334.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  335.         g.Clear(BackColor)
  336.         Dim c As Color() = New Color() {Color.FromArgb(12, 12, 12), Color.FromArgb(50, 50, 50), Color.FromArgb(51, 51, 51), Color.FromArgb(52, 52, 52), Color.FromArgb(53, 53, 53), Color.FromArgb(54, 54, 54), Color.FromArgb(55, 55, 55), Color.FromArgb(56, 56, 56), Color.FromArgb(57, 57, 57)}
  337.         g.FillRectangle(New SolidBrush(Color.FromArgb(57, 57, 57)), rect)
  338.         InnerGlow(g, rect, c)
  339.         g.DrawString(Text, New Font("Verdana", 10, FontStyle.Bold), gb, New Rectangle(12, 4, Width, 16), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  340.         g.DrawEllipse(New Pen(Color.FromArgb(152, 152, 152), 2), selectionrect)
  341.         If Checked Then
  342.             selectionrect.Inflate(-3, -3)
  343.             g.FillEllipse(Brushes.Silver, selectionrect)
  344.         Else
  345.             g.DrawEllipse(New Pen(Color.FromArgb(152, 152, 152)), selectionrect)
  346.         End If
  347.         e.Graphics.DrawImage(b, New Point(0, 0))
  348.         g.Dispose() : b.Dispose()
  349.     End Sub
  350. End Class
  351.  
  352. Public Class GlowCheckBox : Inherits Control
  353.     Private _check As Boolean
  354.     Public Property Checked As Boolean
  355.         Get
  356.             Return _check
  357.         End Get
  358.         Set(value As Boolean)
  359.             _check = value
  360.             Invalidate()
  361.         End Set
  362.     End Property
  363.  
  364.     Sub New()
  365.         MyBase.New()
  366.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  367.         BackColor = Color.Transparent
  368.         DoubleBuffered = True
  369.         Size = New Size(180, 25)
  370.     End Sub
  371.  
  372.     Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  373.         MyBase.OnTextChanged(e)
  374.         Invalidate()
  375.     End Sub
  376.  
  377.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  378.         MyBase.OnClick(e)
  379.         If Not Checked Then Checked = True Else Checked = False
  380.     End Sub
  381.  
  382.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  383.         Dim b As Bitmap = New Bitmap(Width, Height)
  384.         Dim g As Graphics = Graphics.FromImage(b)
  385.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  386.         Dim selectionrect As Rectangle = New Rectangle(5, 5, 12, 12)
  387.         Dim gb As New LinearGradientBrush(selectionrect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), LinearGradientMode.Vertical)
  388.         MyBase.OnPaint(e)
  389.         g.SmoothingMode = SmoothingMode.HighQuality
  390.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  391.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  392.         g.Clear(BackColor)
  393.         Dim c As Color() = New Color() {Color.FromArgb(12, 12, 12), Color.FromArgb(50, 50, 50), Color.FromArgb(51, 51, 51), Color.FromArgb(52, 52, 52), Color.FromArgb(53, 53, 53), Color.FromArgb(54, 54, 54), Color.FromArgb(55, 55, 55), Color.FromArgb(56, 56, 56), Color.FromArgb(57, 57, 57)}
  394.         g.FillRectangle(New SolidBrush(Color.FromArgb(57, 57, 57)), rect)
  395.         InnerGlow(g, rect, c)
  396.         g.DrawString(Text, New Font("Verdana", 10, FontStyle.Bold), gb, New Rectangle(12, 4, Width, 16), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  397.         g.DrawRectangle(New Pen(Color.FromArgb(152, 152, 152), 2), selectionrect)
  398.         If Checked Then
  399.             g.DrawString("b", New Font("Marlett", 12, FontStyle.Regular), New SolidBrush(Color.FromArgb(192, 192, 192)), New Rectangle(6, 7, 12, 12), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  400.         Else
  401.             g.DrawRectangle(New Pen(Color.FromArgb(152, 152, 152)), selectionrect)
  402.         End If
  403.         e.Graphics.DrawImage(b, New Point(0, 0))
  404.         g.Dispose() : b.Dispose()
  405.     End Sub
  406. End Class
  407.  
  408. Public Class GlowProgressBar : Inherits Control
  409.     Private _val As Integer
  410.     Public Property Value() As Integer
  411.         Get
  412.             Return _val
  413.         End Get
  414.         Set(ByVal v As Integer)
  415.             If v > _max Then
  416.                 _val = _max
  417.             ElseIf v < 0 Then
  418.                 _val = 0
  419.             Else
  420.                 _val = v
  421.             End If
  422.             Invalidate()
  423.         End Set
  424.     End Property
  425.  
  426.     Private _max As Integer
  427.     Public Property Maximum() As Integer
  428.         Get
  429.             Return _max
  430.         End Get
  431.         Set(ByVal v As Integer)
  432.             If v < 1 Then
  433.                 _max = 1
  434.             Else
  435.                 _max = v
  436.             End If
  437.             If v < _val Then
  438.                 _val = _max
  439.             End If
  440.             Invalidate()
  441.         End Set
  442.     End Property
  443.  
  444.     Private _showPercentage As Boolean = False
  445.     Public Property ShowPercentage() As Boolean
  446.         Get
  447.             Return _showPercentage
  448.         End Get
  449.         Set(ByVal v As Boolean)
  450.             _showPercentage = v
  451.             Invalidate()
  452.         End Set
  453.     End Property
  454.  
  455.     Sub New()
  456.         MyBase.New()
  457.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  458.         BackColor = Color.Transparent
  459.         Size = New Size(200, 30)
  460.         DoubleBuffered = True
  461.         _max = 100
  462.     End Sub
  463.  
  464.     Protected Overrides Sub OnPaint(e As Windows.Forms.PaintEventArgs)
  465.         Dim b As Bitmap = New Bitmap(Width, Height)
  466.         Dim g As Graphics = Graphics.FromImage(b)
  467.         Dim percent As Integer = CInt((Width - 1) * (_val / _max))
  468.         Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  469.         Dim innerrect As Rectangle = New Rectangle(4, 4, percent - 9, Height - 9)
  470.         MyBase.OnPaint(e)
  471.         g.Clear(BackColor)
  472.         g.SmoothingMode = SmoothingMode.HighQuality
  473.         Dim c As Color() = New Color() {Color.FromArgb(12, 12, 12), Color.FromArgb(50, 50, 50), Color.FromArgb(51, 51, 51), Color.FromArgb(52, 52, 52), Color.FromArgb(53, 53, 53), Color.FromArgb(54, 54, 54), Color.FromArgb(55, 55, 55), Color.FromArgb(56, 56, 56), Color.FromArgb(57, 57, 57)}
  474.         g.FillRectangle(New SolidBrush(Color.FromArgb(57, 57, 57)), outerrect)
  475.         InnerGlow(g, outerrect, c)
  476.         If percent <> 0 Then
  477.             Try
  478.                 Dim c1 As Color() = New Color() {Color.FromArgb(12, 12, 12), Color.FromArgb(50, 50, 50), Color.FromArgb(51, 51, 51), Color.FromArgb(52, 52, 52), Color.FromArgb(53, 53, 53), Color.FromArgb(54, 54, 54), Color.FromArgb(55, 55, 55), Color.FromArgb(56, 56, 56), Color.FromArgb(57, 57, 57)}
  479.                 g.FillRectangle(New SolidBrush(Color.FromArgb(57, 57, 57)), innerrect)
  480.                 InnerGlow(g, innerrect, c1)
  481.             Catch : End Try
  482.         End If
  483.         If _showPercentage Then
  484.             Dim gb As New LinearGradientBrush(outerrect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), LinearGradientMode.Vertical)
  485.             g.DrawString(String.Format("{0}%", _val), New Font("Verdana", 10, FontStyle.Bold), gb, New Rectangle(10, 1, Width - 1, Height - 1), New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  486.         End If
  487.         e.Graphics.DrawImage(b, New Point(0, 0))
  488.         g.Dispose() : b.Dispose()
  489.     End Sub
  490. End Class
  491.  
  492. Public Class GlowGroupBox : Inherits ContainerControl
  493.     Private _showHeader As Boolean = True
  494.     Public Property ShowHeader() As Boolean
  495.         Get
  496.             Return _showHeader
  497.         End Get
  498.         Set(ByVal v As Boolean)
  499.             _showHeader = v
  500.             Invalidate()
  501.         End Set
  502.     End Property
  503.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  504.         MyBase.OnResize(e)
  505.         Invalidate()
  506.     End Sub
  507.  
  508.     Sub New()
  509.         MyBase.New()
  510.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  511.         BackColor = Color.Transparent
  512.         DoubleBuffered = True
  513.         Size = New Size(240, 160)
  514.     End Sub
  515.  
  516.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  517.         Dim b As Bitmap = New Bitmap(Width, Height)
  518.         Dim g As Graphics = Graphics.FromImage(b)
  519.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  520.         Dim headerrect As Rectangle = New Rectangle(0, 0, Width - 1, 25)
  521.         Dim underlinepen As New Pen(Color.FromArgb(92, 92, 92), 2)
  522.         MyBase.OnPaint(e)
  523.         g.SmoothingMode = SmoothingMode.HighQuality
  524.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  525.         g.Clear(BackColor)
  526.         Dim c As Color() = New Color() {Color.FromArgb(12, 12, 12), Color.FromArgb(50, 50, 50), Color.FromArgb(51, 51, 51), Color.FromArgb(52, 52, 52), Color.FromArgb(53, 53, 53), Color.FromArgb(54, 54, 54), Color.FromArgb(55, 55, 55), Color.FromArgb(56, 56, 56), Color.FromArgb(57, 57, 57)}
  527.         g.FillRectangle(New SolidBrush(Color.FromArgb(57, 57, 57)), rect)
  528.         InnerGlow(g, rect, c)
  529.         If _showHeader Then
  530.             Dim gb As New LinearGradientBrush(headerrect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), LinearGradientMode.Vertical)
  531.             g.DrawString(Text, New Font("Verdana", 10, FontStyle.Bold), gb, New Rectangle(0, 0, Width - 1, 30), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  532.             g.DrawLine(underlinepen, 20, 28, Width - 21, 28)
  533.         End If
  534.         e.Graphics.DrawImage(b, New Point(0, 0))
  535.         g.Dispose() : b.Dispose()
  536.     End Sub
  537. End Class
  538.  
  539. Public Class GlowButton : Inherits Control
  540.     Dim _state As MouseState
  541.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  542.         MyBase.OnMouseDown(e)
  543.         _state = MouseState.Down
  544.         Invalidate()
  545.     End Sub
  546.  
  547.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  548.         MyBase.OnMouseUp(e)
  549.         _state = MouseState.Over
  550.         Invalidate()
  551.     End Sub
  552.  
  553.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  554.         MyBase.OnMouseEnter(e)
  555.         _state = MouseState.Over
  556.         Invalidate()
  557.     End Sub
  558.  
  559.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  560.         MyBase.OnMouseLeave(e)
  561.         _state = MouseState.None
  562.         Invalidate()
  563.     End Sub
  564.  
  565.     Sub New()
  566.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  567.         BackColor = Color.Transparent
  568.         DoubleBuffered = True
  569.         Size = New Size(150, 30)
  570.         _state = MouseState.None
  571.     End Sub
  572.  
  573.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  574.         Dim b As Bitmap = New Bitmap(Width, Height)
  575.         Dim g As Graphics = Graphics.FromImage(b)
  576.         Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  577.         Dim innerrect As Rectangle = New Rectangle(2, 2, Width - 5, Height - 5)
  578.         Dim btnfont As New Font("Verdana", 10, FontStyle.Bold)
  579.         Dim gb As New LinearGradientBrush(outerrect, Color.FromArgb(32, 32, 32), Color.FromArgb(72, 72, 72), LinearGradientMode.Vertical)
  580.         MyBase.OnPaint(e)
  581.         g.SmoothingMode = SmoothingMode.HighQuality
  582.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  583.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  584.         g.Clear(BackColor)
  585.         Select Case _state
  586.             Case MouseState.None
  587.                 Dim buttonrectnone As New LinearGradientBrush(outerrect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), LinearGradientMode.Vertical)
  588.                 g.FillPath(buttonrectnone, RoundRect(outerrect, 3))
  589.                 g.DrawPath(New Pen(Brushes.Black), RoundRect(outerrect, 3))
  590.                 g.DrawString(Text, btnfont, gb, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  591.             Case MouseState.Down
  592.                 Dim buttonrectdown As New LinearGradientBrush(outerrect, Color.FromArgb(82, 82, 82), Color.FromArgb(122, 122, 122), LinearGradientMode.Vertical)
  593.                 g.FillPath(buttonrectdown, RoundRect(outerrect, 3))
  594.                 g.DrawPath(New Pen(Brushes.Black), RoundRect(outerrect, 3))
  595.                 g.DrawString(Text, btnfont, gb, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  596.             Case MouseState.Over
  597.                 Dim buttonrectover As New LinearGradientBrush(innerrect, Color.FromArgb(92, 92, 92), Color.FromArgb(132, 132, 132), LinearGradientMode.Vertical)
  598.                 g.FillPath(buttonrectover, RoundRect(innerrect, 3))
  599.                 g.DrawPath(New Pen(Brushes.Black), RoundRect(innerrect, 3))
  600.                 g.DrawString(Text, btnfont, gb, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  601.         End Select
  602.         e.Graphics.DrawImage(b, New Point(0, 0))
  603.         g.Dispose() : b.Dispose()
  604.     End Sub
  605. End Class
  606.  
  607. Public Class GlowTextBox : Inherits Control
  608.     Dim WithEvents _tb As New TextBox
  609.  
  610.     Private _allowpassword As Boolean = False
  611.     Public Shadows Property UseSystemPasswordChar() As Boolean
  612.         Get
  613.             Return _allowpassword
  614.         End Get
  615.         Set(ByVal value As Boolean)
  616.             _tb.UseSystemPasswordChar = UseSystemPasswordChar
  617.             _allowpassword = value
  618.             Invalidate()
  619.         End Set
  620.     End Property
  621.  
  622.     Private _maxChars As Integer = 32767
  623.     Public Shadows Property MaxLength() As Integer
  624.         Get
  625.             Return _maxChars
  626.         End Get
  627.         Set(ByVal value As Integer)
  628.             _maxChars = value
  629.             _tb.MaxLength = MaxLength
  630.             Invalidate()
  631.         End Set
  632.     End Property
  633.  
  634.     Private _textAlignment As HorizontalAlignment
  635.     Public Shadows Property TextAlign() As HorizontalAlignment
  636.         Get
  637.             Return _textAlignment
  638.         End Get
  639.         Set(ByVal value As HorizontalAlignment)
  640.             _textAlignment = value
  641.             Invalidate()
  642.         End Set
  643.     End Property
  644.  
  645.     Private _multiLine As Boolean = False
  646.     Public Shadows Property MultiLine() As Boolean
  647.         Get
  648.             Return _multiLine
  649.         End Get
  650.         Set(ByVal value As Boolean)
  651.             _multiLine = value
  652.             _tb.Multiline = value
  653.             OnResize(EventArgs.Empty)
  654.             Invalidate()
  655.         End Set
  656.     End Property
  657.  
  658.     Private _readOnly As Boolean = False
  659.     Public Shadows Property [ReadOnly]() As Boolean
  660.         Get
  661.             Return _readOnly
  662.         End Get
  663.         Set(ByVal value As Boolean)
  664.             _readOnly = value
  665.             If _tb IsNot Nothing Then
  666.                 _tb.ReadOnly = value
  667.             End If
  668.         End Set
  669.     End Property
  670.  
  671.     Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  672.         MyBase.OnTextChanged(e)
  673.         Invalidate()
  674.     End Sub
  675.  
  676.     Protected Overrides Sub OnBackColorChanged(ByVal e As EventArgs)
  677.         MyBase.OnBackColorChanged(e)
  678.         Invalidate()
  679.     End Sub
  680.  
  681.     Protected Overrides Sub OnForeColorChanged(ByVal e As EventArgs)
  682.         MyBase.OnForeColorChanged(e)
  683.         _tb.ForeColor = ForeColor
  684.         Invalidate()
  685.     End Sub
  686.  
  687.     Protected Overrides Sub OnFontChanged(ByVal e As EventArgs)
  688.         MyBase.OnFontChanged(e)
  689.         _tb.Font = Font
  690.     End Sub
  691.  
  692.     Protected Overrides Sub OnGotFocus(ByVal e As EventArgs)
  693.         MyBase.OnGotFocus(e)
  694.         _tb.Focus()
  695.     End Sub
  696.  
  697.     Private Sub TextChangeTb() Handles _tb.TextChanged
  698.         Text = _tb.Text
  699.     End Sub
  700.  
  701.     Private Sub TextChng() Handles MyBase.TextChanged
  702.         _tb.Text = Text
  703.     End Sub
  704.  
  705.     Public Sub NewTextBox()
  706.         With _tb
  707.             .Text = String.Empty
  708.             .BackColor = Color.FromArgb(57, 57, 57)
  709.             .ForeColor = ForeColor
  710.             .TextAlign = HorizontalAlignment.Center
  711.             .BorderStyle = BorderStyle.None
  712.             .Location = New Point(3, 3)
  713.             .Font = New Font("Verdana", 10, FontStyle.Regular)
  714.             .Size = New Size(Width - 3, Height - 3)
  715.             .UseSystemPasswordChar = UseSystemPasswordChar
  716.         End With
  717.     End Sub
  718.  
  719.     Sub New()
  720.         MyBase.New()
  721.         NewTextBox()
  722.         Controls.Add(_tb)
  723.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  724.         DoubleBuffered = True
  725.         BackColor = Color.FromArgb(57, 57, 57)
  726.         ForeColor = Color.FromArgb(112, 112, 112)
  727.         Font = New Font("Verdana", 10, FontStyle.Bold)
  728.         Size = New Size(150, 30)
  729.     End Sub
  730.  
  731.     Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  732.         Dim b As Bitmap = New Bitmap(Width, Height)
  733.         Dim g As Graphics = Graphics.FromImage(b)
  734.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  735.         MyBase.OnPaint(e)
  736.         g.SmoothingMode = SmoothingMode.HighQuality
  737.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  738.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  739.         With _tb
  740.             .TextAlign = TextAlign
  741.             .UseSystemPasswordChar = UseSystemPasswordChar
  742.         End With
  743.         Dim c As Color() = New Color() {Color.FromArgb(12, 12, 12), Color.FromArgb(50, 50, 50), Color.FromArgb(51, 51, 51), Color.FromArgb(52, 52, 52), Color.FromArgb(53, 53, 53), Color.FromArgb(54, 54, 54), Color.FromArgb(55, 55, 55), Color.FromArgb(56, 56, 56), Color.FromArgb(57, 57, 57)}
  744.         g.FillRectangle(New SolidBrush(Color.FromArgb(57, 57, 57)), rect)
  745.         InnerGlow(g, rect, c)
  746.         e.Graphics.DrawImage(b, New Point(0, 0))
  747.         g.Dispose() : b.Dispose()
  748.     End Sub
  749.  
  750.     Protected Overrides Sub OnResize(e As EventArgs)
  751.         MyBase.OnResize(e)
  752.         If Not MultiLine Then
  753.             Dim tbheight As Integer = _tb.Height
  754.             _tb.Location = New Point(10, CType(((Height / 2) - (tbheight / 2) - 1), Integer))
  755.             _tb.Size = New Size(Width - 20, tbheight)
  756.         Else
  757.             _tb.Location = New Point(10, 10)
  758.             _tb.Size = New Size(Width - 20, Height - 20)
  759.         End If
  760.     End Sub
  761. End Class
  762.  
  763. Public Class GlowLabel : Inherits Control
  764.  
  765.     Sub New()
  766.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  767.         BackColor = Color.Transparent
  768.         DoubleBuffered = True
  769.         Size = New Size(150, 30)
  770.     End Sub
  771.  
  772.     Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  773.         Dim b As Bitmap = New Bitmap(Width, Height)
  774.         Dim g As Graphics = Graphics.FromImage(b)
  775.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  776.         Dim gb As New LinearGradientBrush(rect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), LinearGradientMode.Vertical)
  777.         MyBase.OnPaint(e)
  778.         g.Clear(BackColor)
  779.         g.SmoothingMode = SmoothingMode.HighQuality
  780.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  781.         Dim c As Color() = New Color() {Color.FromArgb(12, 12, 12), Color.FromArgb(50, 50, 50), Color.FromArgb(51, 51, 51), Color.FromArgb(52, 52, 52), Color.FromArgb(53, 53, 53), Color.FromArgb(54, 54, 54), Color.FromArgb(55, 55, 55), Color.FromArgb(56, 56, 56), Color.FromArgb(57, 57, 57)}
  782.         g.FillRectangle(New SolidBrush(Color.FromArgb(57, 57, 57)), rect)
  783.         InnerGlow(g, rect, c)
  784.         g.DrawPath(New Pen(Brushes.Black), RoundRect(rect, 3))
  785.         g.DrawString(Text, New Font("Verdana", 10, FontStyle.Bold), gb, rect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  786.         e.Graphics.DrawImage(b, New Point(0, 0))
  787.         g.Dispose() : b.Dispose()
  788.     End Sub
  789. End Class
  790.  
  791. Public Class GlowTabControl : Inherits TabControl
  792.  
  793.     Sub New()
  794.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  795.         BackColor = Color.Transparent
  796.         DoubleBuffered = True
  797.         ItemSize = New Size(80, 35)
  798.     End Sub
  799.  
  800.     Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  801.         Dim b As Bitmap = New Bitmap(Width, Height)
  802.         Dim g As Graphics = Graphics.FromImage(b)
  803.         Dim rect As Rectangle = New Rectangle(0, 0, Width, Height)
  804.         Dim gb As New LinearGradientBrush(rect, Color.FromArgb(32, 32, 32), Color.FromArgb(72, 72, 72), LinearGradientMode.Vertical)
  805.         Try : SelectedTab.BackColor = Color.FromArgb(92, 92, 92) : Catch : End Try
  806.         MyBase.OnPaint(e)
  807.         g.Clear(BackColor)
  808.         Dim c As Color() = New Color() {Color.FromArgb(12, 12, 12), Color.FromArgb(50, 50, 50), Color.FromArgb(51, 51, 51), Color.FromArgb(52, 52, 52), Color.FromArgb(53, 53, 53), Color.FromArgb(54, 54, 54), Color.FromArgb(55, 55, 55), Color.FromArgb(56, 56, 56), Color.FromArgb(57, 57, 57)}
  809.         g.FillRectangle(New SolidBrush(Color.FromArgb(57, 57, 57)), rect)
  810.         InnerGlow(g, rect, c)
  811.         For i = 0 To TabCount - 1
  812.             Dim textRectangle As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 2, GetTabRect(i).Location.Y + 1), New Size(GetTabRect(i).Width, GetTabRect(i).Height - 5))
  813.             If i = SelectedIndex Then
  814.                 Dim tabrect As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 3, GetTabRect(i).Location.Y + 3), New Size(GetTabRect(i).Width - 6, GetTabRect(i).Height - 9))
  815.                 Dim gb1 As New LinearGradientBrush(tabrect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), LinearGradientMode.Vertical)
  816.                 g.FillPath(gb1, RoundRect(tabrect, 3))
  817.                 g.DrawPath(New Pen(Brushes.Black), RoundRect(tabrect, 3))
  818.                 g.DrawString(TabPages(i).Text, New Font("Verdana", 8, FontStyle.Bold), gb, textRectangle, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  819.             Else
  820.                 g.DrawString(TabPages(i).Text, New Font("Verdana", 8, FontStyle.Bold), New SolidBrush(Color.FromArgb(255, 255, 255)), textRectangle, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  821.             End If
  822.         Next
  823.         e.Graphics.DrawImage(b, New Point(0, 0))
  824.         g.Dispose() : b.Dispose()
  825.     End Sub
  826. End Class
  827.  
  828. Public Class GlowToggle : Inherits Control
  829.     Private _check As Boolean
  830.     Public Property Checked As Boolean
  831.         Get
  832.             Return _check
  833.         End Get
  834.         Set(value As Boolean)
  835.             _check = value
  836.             Invalidate()
  837.         End Set
  838.     End Property
  839.  
  840.     Sub New()
  841.         MyBase.New()
  842.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  843.         DoubleBuffered = True
  844.         BackColor = Color.Transparent
  845.         Size = New Size(80, 25)
  846.     End Sub
  847.  
  848.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  849.         MyBase.OnClick(e)
  850.         If Not Checked Then Checked = True Else Checked = False
  851.     End Sub
  852.  
  853.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  854.         Dim b As Bitmap = New Bitmap(Width, Height)
  855.         Dim g As Graphics = Graphics.FromImage(b)
  856.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  857.         Dim onrect As Rectangle = New Rectangle(CInt((Width / 2) - 2), 2, CInt((Width / 2) - 1), Height - 5)
  858.         Dim offrect As Rectangle = New Rectangle(2, 2, CInt((Width / 2) - 1), Height - 5)
  859.         Dim gb As New LinearGradientBrush(onrect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), LinearGradientMode.Vertical)
  860.         Dim gb1 As New LinearGradientBrush(onrect, Color.FromArgb(32, 32, 32), Color.FromArgb(72, 72, 72), LinearGradientMode.Vertical)
  861.         MyBase.OnPaint(e)
  862.         g.Clear(BackColor)
  863.         g.SmoothingMode = SmoothingMode.HighQuality
  864.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  865.         Dim c As Color() = New Color() {Color.FromArgb(12, 12, 12), Color.FromArgb(50, 50, 50), Color.FromArgb(51, 51, 51), Color.FromArgb(52, 52, 52), Color.FromArgb(53, 53, 53), Color.FromArgb(54, 54, 54), Color.FromArgb(55, 55, 55), Color.FromArgb(56, 56, 56), Color.FromArgb(57, 57, 57)}
  866.         g.FillRectangle(New SolidBrush(Color.FromArgb(57, 57, 57)), rect)
  867.         InnerGlow(g, rect, c)
  868.         If Checked Then
  869.             g.FillPath(gb1, RoundRect(onrect, 3))
  870.             g.DrawString("ON", New Font("Verdana", 10, FontStyle.Bold), gb, New Rectangle(0, 5, CInt((Width / 2)), 15), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  871.             g.DrawLine(New Pen(Color.Black), 56, 5, 56, Height - 7)
  872.             g.DrawLine(New Pen(Color.Black), 58, 3, 58, Height - 5)
  873.             g.DrawLine(New Pen(Color.Black), 60, 5, 60, Height - 7)
  874.         Else
  875.             g.FillPath(gb1, RoundRect(offrect, 3))
  876.             g.DrawString("OFF", New Font("Verdana", 10, FontStyle.Bold), gb, New Rectangle(CInt((Width / 2)), 5, CInt((Width / 2)), 15), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  877.             g.DrawLine(New Pen(Color.Black), 20, 5, 20, Height - 7)
  878.             g.DrawLine(New Pen(Color.Black), 22, 3, 22, Height - 5)
  879.             g.DrawLine(New Pen(Color.Black), 24, 5, 24, Height - 7)
  880.         End If
  881.         e.Graphics.DrawImage(b, New Point(0, 0))
  882.         g.Dispose() : b.Dispose()
  883.     End Sub
  884. End Class
  885.  
  886. Public Class GlowSeperator : Inherits Control
  887.  
  888.     Enum Style
  889.         Horizontal
  890.         Verticle
  891.     End Enum
  892.  
  893.     Private _alignment As Style = Style.Horizontal
  894.     Public Property Alignment As Style
  895.         Get
  896.             Return _alignment
  897.         End Get
  898.         Set(ByVal value As Style)
  899.             _alignment = value
  900.         End Set
  901.     End Property
  902.  
  903.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  904.         MyBase.OnResize(e)
  905.         Invalidate()
  906.     End Sub
  907.  
  908.     Sub New()
  909.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  910.         DoubleBuffered = True
  911.         BackColor = Color.Transparent
  912.     End Sub
  913.  
  914.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  915.         Dim b As Bitmap = New Bitmap(Width, Height)
  916.         Dim g As Graphics = Graphics.FromImage(b)
  917.         MyBase.OnPaint(e)
  918.         g.Clear(BackColor)
  919.         g.SmoothingMode = SmoothingMode.HighQuality
  920.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  921.         Select Case _alignment
  922.             Case Style.Horizontal
  923.                 g.DrawLine(New Pen(Color.FromArgb(32, 32, 32), 3), New Point(0, CType((Height / 2), Integer)), New Point(Width, CType((Height / 2), Integer)))
  924.             Case Style.Verticle
  925.                 g.DrawLine(New Pen(Color.FromArgb(32, 32, 32), 3), New Point(CType((Width / 2), Integer), 0), New Point(CType((Width / 2), Integer), Height))
  926.         End Select
  927.         e.Graphics.DrawImage(b, New Point(0, 0))
  928.         g.Dispose() : b.Dispose()
  929.     End Sub
  930. End Class
  931.  
  932. Public Class GlowPanel : Inherits ContainerControl
  933.  
  934.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  935.         MyBase.OnResize(e)
  936.         Invalidate()
  937.     End Sub
  938.  
  939.     Sub New()
  940.         MyBase.New()
  941.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  942.         BackColor = Color.Transparent
  943.         DoubleBuffered = True
  944.         Size = New Size(240, 160)
  945.     End Sub
  946.  
  947.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  948.         Dim b As Bitmap = New Bitmap(Width, Height)
  949.         Dim g As Graphics = Graphics.FromImage(b)
  950.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  951.         MyBase.OnPaint(e)
  952.         g.SmoothingMode = SmoothingMode.HighQuality
  953.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  954.         g.Clear(BackColor)
  955.         Dim c As Color() = New Color() {Color.FromArgb(12, 12, 12), Color.FromArgb(50, 50, 50), Color.FromArgb(51, 51, 51), Color.FromArgb(52, 52, 52), Color.FromArgb(53, 53, 53), Color.FromArgb(54, 54, 54), Color.FromArgb(55, 55, 55), Color.FromArgb(56, 56, 56), Color.FromArgb(57, 57, 57)}
  956.         g.FillRectangle(New SolidBrush(Color.FromArgb(57, 57, 57)), rect)
  957.         InnerGlow(g, rect, c)
  958.         e.Graphics.DrawImage(b, New Point(0, 0))
  959.         g.Dispose() : b.Dispose()
  960.     End Sub
  961. End Class
  962.  
  963. Public Class GlowVerticalProgressBar : Inherits Control
  964.     Private _val As Integer
  965.     Public Property Value() As Integer
  966.         Get
  967.             Return _val
  968.         End Get
  969.         Set(ByVal v As Integer)
  970.             If v > _max Then
  971.                 _val = _max
  972.             ElseIf v < 0 Then
  973.                 _val = 0
  974.             Else
  975.                 _val = v
  976.             End If
  977.             Invalidate()
  978.         End Set
  979.     End Property
  980.  
  981.     Private _max As Integer
  982.     Public Property Maximum() As Integer
  983.         Get
  984.             Return _max
  985.         End Get
  986.         Set(ByVal v As Integer)
  987.             If v < 1 Then
  988.                 _max = 1
  989.             Else
  990.                 _max = v
  991.             End If
  992.             If v < _val Then
  993.                 _val = _max
  994.             End If
  995.             Invalidate()
  996.         End Set
  997.     End Property
  998.  
  999.     Private _showPercentage As Boolean = False
  1000.     Public Property ShowPercentage() As Boolean
  1001.         Get
  1002.             Return _showPercentage
  1003.         End Get
  1004.         Set(ByVal v As Boolean)
  1005.             _showPercentage = v
  1006.             Invalidate()
  1007.         End Set
  1008.     End Property
  1009.  
  1010.     Sub New()
  1011.         MyBase.New()
  1012.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  1013.         BackColor = Color.Transparent
  1014.         Size = New Size(30, 200)
  1015.         DoubleBuffered = True
  1016.         _max = 100
  1017.     End Sub
  1018.  
  1019.     Protected Overrides Sub OnPaint(e As Windows.Forms.PaintEventArgs)
  1020.         Dim b As Bitmap = New Bitmap(Width, Height)
  1021.         Dim g As Graphics = Graphics.FromImage(b)
  1022.         Dim percent As Integer = CInt((Height - 1) * (_val / _max))
  1023.         Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1024.         Dim innerrect As Rectangle = New Rectangle(4, (Height - percent) + 4, Width - 9, percent - 9)
  1025.         MyBase.OnPaint(e)
  1026.         g.Clear(BackColor)
  1027.         g.SmoothingMode = SmoothingMode.HighQuality
  1028.         Dim c As Color() = New Color() {Color.FromArgb(12, 12, 12), Color.FromArgb(50, 50, 50), Color.FromArgb(51, 51, 51), Color.FromArgb(52, 52, 52), Color.FromArgb(53, 53, 53), Color.FromArgb(54, 54, 54), Color.FromArgb(55, 55, 55), Color.FromArgb(56, 56, 56), Color.FromArgb(57, 57, 57)}
  1029.         g.FillRectangle(New SolidBrush(Color.FromArgb(57, 57, 57)), outerrect)
  1030.         InnerGlow(g, outerrect, c)
  1031.         If percent <> 0 Then
  1032.             Try
  1033.                 Dim c1 As Color() = New Color() {Color.FromArgb(12, 12, 12), Color.FromArgb(50, 50, 50), Color.FromArgb(51, 51, 51), Color.FromArgb(52, 52, 52), Color.FromArgb(53, 53, 53), Color.FromArgb(54, 54, 54), Color.FromArgb(55, 55, 55), Color.FromArgb(56, 56, 56), Color.FromArgb(57, 57, 57)}
  1034.                 g.FillRectangle(New SolidBrush(Color.FromArgb(57, 57, 57)), innerrect)
  1035.                 InnerGlow(g, innerrect, c1)
  1036.             Catch : End Try
  1037.         End If
  1038.         If _showPercentage Then
  1039.             Dim gb As New LinearGradientBrush(outerrect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), LinearGradientMode.Vertical)
  1040.             g.DrawString(String.Format("{0}%", _val), New Font("Verdana", 10, FontStyle.Bold), gb, outerrect, New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1041.         End If
  1042.         e.Graphics.DrawImage(b, New Point(0, 0))
  1043.         g.Dispose() : b.Dispose()
  1044.     End Sub
  1045. End Class
  1046.  
  1047. Public Class GlowMinimalTheme : Inherits ContainerControl
  1048.     Private _mousepos As Point = New Point(0, 0)
  1049.     Private _drag As Boolean = False
  1050.     'Private _icon As Icon
  1051.     'Public Property Icon() As Icon
  1052.     '    Get
  1053.     '        Return _icon
  1054.     '    End Get
  1055.     '    Set(ByVal value As Icon)
  1056.     '        _icon = value
  1057.     '        Invalidate()
  1058.     '    End Set
  1059.     'End Property
  1060.  
  1061.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1062.         MyBase.OnMouseDown(e)
  1063.         If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(7, 7, Width - 15, 40).Contains(e.Location) Then
  1064.             _drag = True : _mousepos = e.Location
  1065.         End If
  1066.     End Sub
  1067.  
  1068.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1069.         MyBase.OnMouseUp(e)
  1070.         _drag = False
  1071.     End Sub
  1072.  
  1073.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  1074.         MyBase.OnMouseMove(e)
  1075.         If _drag Then
  1076.             Parent.Location = New Point(MousePosition.X - _mousepos.X, MousePosition.Y - _mousepos.Y)
  1077.         End If
  1078.     End Sub
  1079.  
  1080.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  1081.         MyBase.OnResize(e)
  1082.         Invalidate()
  1083.     End Sub
  1084.  
  1085.     Sub New()
  1086.         MyBase.New()
  1087.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  1088.         BackColor = Color.FromArgb(32, 32, 32)
  1089.         DoubleBuffered = True
  1090.     End Sub
  1091.  
  1092.     Protected Overrides Sub OnCreateControl()
  1093.         MyBase.OnCreateControl()
  1094.         ParentForm.FormBorderStyle = FormBorderStyle.None
  1095.         ParentForm.TransparencyKey = Color.Fuchsia
  1096.         Dock = DockStyle.Fill
  1097.     End Sub
  1098.  
  1099.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1100.         Dim b As Bitmap = New Bitmap(Width, Height)
  1101.         Dim g As Graphics = Graphics.FromImage(b)
  1102.         Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1103.         Dim innerrect As Rectangle = New Rectangle(7, 52, Width - 15, Height - 60)
  1104.         Dim headerrect As Rectangle = New Rectangle(7, 7, Width - 15, 40)
  1105.         MyBase.OnPaint(e)
  1106.         g.Clear(Color.Fuchsia)
  1107.         Dim orb As New LinearGradientBrush(outerrect, Color.FromArgb(63, 70, 88), Color.FromArgb(40, 42, 55), 90S)
  1108.         g.FillPath(orb, RoundRect(outerrect, 5))
  1109.         g.DrawPath(New Pen(Brushes.Black), RoundRect(outerrect, 5))
  1110.         Dim irb As New LinearGradientBrush(innerrect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), 90S)
  1111.         g.FillPath(irb, RoundRect(innerrect, 7))
  1112.         g.DrawPath(New Pen(Brushes.Black), RoundRect(innerrect, 7))
  1113.         Dim lhrb As New LinearGradientBrush(headerrect, Color.FromArgb(72, 72, 72), Color.FromArgb(112, 112, 112), 90S)
  1114.         g.FillPath(lhrb, RoundRect(headerrect, 7))
  1115.         g.DrawPath(New Pen(Brushes.Black), RoundRect(headerrect, 7))
  1116.         'Try
  1117.         '    g.DrawIcon(_icon, New Rectangle(15, 15, 26, 26))
  1118.         'Catch : End Try
  1119.         Dim htgb As New LinearGradientBrush(headerrect, Color.FromArgb(12, 12, 12), Color.FromArgb(112, 112, 112), LinearGradientMode.Vertical)
  1120.         g.DrawString(Text, New Font("Verdana", 15, FontStyle.Bold), htgb, headerrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1121.         e.Graphics.DrawImage(b, New Point(0, 0))
  1122.         g.Dispose() : b.Dispose()
  1123.     End Sub
  1124. End Class
Advertisement
Add Comment
Please, Sign In to add comment