SaketSaket

Fader Theme 1 HF

Dec 13th, 2014
1,691
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 80.98 KB | None | 0 0
  1. Option Strict On
  2.  
  3. Imports System.Drawing.Drawing2D
  4. Imports System.Drawing.Text
  5.  
  6. '<info>
  7. ' --------------------Fader Theme--------------------
  8. ' Creator - SaketSaket (HF)
  9. ' UID - 1869668
  10. ' Inspiration & Credits to all Theme creators of HF
  11. ' Version - 1.0
  12. ' Date Created - 1st December 2014
  13. ' Date Modified - 13th December 2014
  14. '
  15. '
  16. 'Special Thanks to Aeonhack for RoundRect Functions...
  17. 'AlertBox Control idea taken from iSynthesis' Flat UI theme
  18. '
  19. '
  20. ' For bugs & Constructive Criticism contact me on HF
  21. ' If you like it & want to DONATE then pm me on HF
  22. ' --------------------Fader Theme--------------------
  23. '<info>
  24.  
  25. 'Please Leave Credits in Source, Do not redistribute
  26.  
  27. Enum MouseState As Byte
  28.     None = 0
  29.     Over = 1
  30.     Down = 2
  31. End Enum
  32.  
  33. Public Enum AlignmentStyle
  34.     Center
  35.     Left
  36.     Right
  37. End Enum
  38.  
  39. Module Draw
  40.     'Special Thanks to Aeonhack for RoundRect Functions... ;)
  41.     Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
  42.         Dim p As GraphicsPath = New GraphicsPath()
  43.         Dim arcRectangleWidth As Integer = curve * 2
  44.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  45.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  46.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  47.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  48.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  49.         Return p
  50.     End Function
  51. End Module
  52.  
  53. Public Class FaderTheme : Inherits ContainerControl
  54.     Private _mousepos As Point = New Point(0, 0)
  55.     Private _drag As Boolean = False
  56.     Private _icon As Icon
  57.  
  58.     Public Property Icon() As Icon
  59.         Get
  60.             Return _icon
  61.         End Get
  62.         Set(ByVal value As Icon)
  63.             _icon = value
  64.             Invalidate()
  65.         End Set
  66.     End Property
  67.  
  68.     Private _showicon As Boolean = True
  69.     Public Property ShowIcon As Boolean
  70.         Get
  71.             Return _showicon
  72.         End Get
  73.         Set(value As Boolean)
  74.             _showicon = value
  75.             Invalidate()
  76.         End Set
  77.     End Property
  78.  
  79.     Private _showheader As Boolean = True
  80.     Public Property ShowHeader As Boolean
  81.         Get
  82.             Return _showheader
  83.         End Get
  84.         Set(value As Boolean)
  85.             _showheader = value
  86.             Invalidate()
  87.         End Set
  88.     End Property
  89.  
  90.     Private _headerAlignment As AlignmentStyle = AlignmentStyle.Center
  91.     Public Property HeaderAlignment As AlignmentStyle
  92.         Get
  93.             Return _headerAlignment
  94.         End Get
  95.         Set(value As AlignmentStyle)
  96.             _headerAlignment = value
  97.             Invalidate()
  98.         End Set
  99.     End Property
  100.  
  101.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  102.         MyBase.OnMouseDown(e)
  103.         If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(15, 10, Width - 31, 45).Contains(e.Location) Then
  104.             _drag = True : _mousepos = e.Location
  105.         End If
  106.     End Sub
  107.  
  108.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  109.         MyBase.OnMouseUp(e)
  110.         _drag = False
  111.     End Sub
  112.  
  113.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  114.         MyBase.OnMouseMove(e)
  115.         If _drag Then
  116.             Parent.Location = New Point(MousePosition.X - _mousepos.X, MousePosition.Y - _mousepos.Y)
  117.         End If
  118.     End Sub
  119.  
  120.     Sub New()
  121.         MyBase.New()
  122.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint, True)
  123.         DoubleBuffered = True
  124.     End Sub
  125.  
  126.     Protected Overrides Sub OnCreateControl()
  127.         MyBase.OnCreateControl()
  128.         ParentForm.FormBorderStyle = FormBorderStyle.None
  129.         ParentForm.TransparencyKey = Color.Fuchsia
  130.         Dock = DockStyle.Fill
  131.     End Sub
  132.  
  133.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  134.         Dim b As Bitmap = New Bitmap(Width, Height)
  135.         Dim g As Graphics = Graphics.FromImage(b)
  136.  
  137.         Dim bodyrect As Rectangle = New Rectangle(15, 10, Width - 31, Height - 21)
  138.         Dim headerrect As Rectangle = New Rectangle(15, 10, Width - 31, 50)
  139.         Dim footerrect As Rectangle = New Rectangle(15, Height - 25, Width - 31, 15)
  140.         Dim leftborder As Rectangle = New Rectangle(0, 0, 15, Height - 1)
  141.         Dim rightborder As Rectangle = New Rectangle(Width - 16, 0, 15, Height - 1)
  142.  
  143.         MyBase.OnPaint(e)
  144.         g.Clear(Color.Fuchsia)
  145.  
  146.         Dim bodygb As New LinearGradientBrush(bodyrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  147.         g.FillRectangle(bodygb, bodyrect)
  148.         g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  149.  
  150.         Dim headergb As New LinearGradientBrush(headerrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  151.         g.FillRectangle(headergb, headerrect)
  152.         g.DrawRectangle(New Pen(Brushes.Black), headerrect)
  153.  
  154.         Dim footergb As New LinearGradientBrush(footerrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  155.         g.FillRectangle(footergb, footerrect)
  156.         g.DrawRectangle(New Pen(Brushes.Black), footerrect)
  157.  
  158.         Dim leftbordergb As New LinearGradientBrush(leftborder, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Horizontal)
  159.         g.FillPath(leftbordergb, RoundRect(leftborder, 7))
  160.         g.DrawPath(New Pen(Brushes.Black), RoundRect(leftborder, 7))
  161.  
  162.         Dim rightbordergb As New LinearGradientBrush(rightborder, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Horizontal)
  163.         g.FillPath(rightbordergb, RoundRect(rightborder, 7))
  164.         g.DrawPath(New Pen(Brushes.Black), RoundRect(rightborder, 7))
  165.  
  166.         If ShowIcon = True Then
  167.             Try
  168.                 g.DrawIcon(_icon, New Rectangle(20, 17, 38, 38))
  169.             Catch : End Try
  170.         End If
  171.  
  172.         If ShowHeader = True Then
  173.             Select Case _headerAlignment
  174.                 Case AlignmentStyle.Left
  175.                     g.DrawString(Text, New Font("Segoe UI", 15, FontStyle.Bold), New SolidBrush(Color.FromArgb(220, 220, 220)), New Rectangle(65, 10, Width - 31, 45), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  176.                 Case AlignmentStyle.Center
  177.                     g.DrawString(Text, New Font("Segoe UI", 15, FontStyle.Bold), New SolidBrush(Color.FromArgb(220, 220, 220)), headerrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  178.                 Case AlignmentStyle.Right
  179.                     g.DrawString(Text, New Font("Segoe UI", 15, FontStyle.Bold), New SolidBrush(Color.FromArgb(220, 220, 220)), New Rectangle(0, 10, Width - 120, 45), New StringFormat() With {.Alignment = StringAlignment.Far, .LineAlignment = StringAlignment.Center})
  180.             End Select
  181.         End If
  182.  
  183.         e.Graphics.DrawImage(b, New Point(0, 0))
  184.         g.Dispose() : b.Dispose()
  185.     End Sub
  186. End Class
  187.  
  188. Public Class FaderMinimalTheme : Inherits ContainerControl
  189.     Private _mousepos As Point = New Point(0, 0)
  190.     Private _drag As Boolean = False
  191.  
  192.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  193.         MyBase.OnMouseDown(e)
  194.         If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(15, 10, Width - 31, 45).Contains(e.Location) Then
  195.             _drag = True : _mousepos = e.Location
  196.         End If
  197.     End Sub
  198.  
  199.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  200.         MyBase.OnMouseUp(e)
  201.         _drag = False
  202.     End Sub
  203.  
  204.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  205.         MyBase.OnMouseMove(e)
  206.         If _drag Then
  207.             Parent.Location = New Point(MousePosition.X - _mousepos.X, MousePosition.Y - _mousepos.Y)
  208.         End If
  209.     End Sub
  210.  
  211.     Sub New()
  212.         MyBase.New()
  213.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint, True)
  214.         DoubleBuffered = True
  215.     End Sub
  216.  
  217.     Protected Overrides Sub OnCreateControl()
  218.         MyBase.OnCreateControl()
  219.         ParentForm.FormBorderStyle = FormBorderStyle.None
  220.         ParentForm.TransparencyKey = Color.Fuchsia
  221.         Dock = DockStyle.Fill
  222.     End Sub
  223.  
  224.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  225.         Dim b As Bitmap = New Bitmap(Width, Height)
  226.         Dim g As Graphics = Graphics.FromImage(b)
  227.  
  228.         Dim bodyrect As Rectangle = New Rectangle(15, 10, Width - 31, Height - 21)
  229.         Dim headerrect As Rectangle = New Rectangle(15, 10, Width - 31, 15)
  230.         Dim footerrect As Rectangle = New Rectangle(15, Height - 25, Width - 31, 15)
  231.         Dim leftborder As Rectangle = New Rectangle(0, 0, 15, Height - 1)
  232.         Dim rightborder As Rectangle = New Rectangle(Width - 16, 0, 15, Height - 1)
  233.  
  234.         MyBase.OnPaint(e)
  235.         g.Clear(Color.Fuchsia)
  236.  
  237.         Dim bodygb As New LinearGradientBrush(bodyrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  238.         g.FillRectangle(bodygb, bodyrect)
  239.         g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  240.  
  241.         Dim headergb As New LinearGradientBrush(headerrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  242.         g.FillRectangle(headergb, headerrect)
  243.         g.DrawRectangle(New Pen(Brushes.Black), headerrect)
  244.  
  245.         Dim footergb As New LinearGradientBrush(footerrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  246.         g.FillRectangle(footergb, footerrect)
  247.         g.DrawRectangle(New Pen(Brushes.Black), footerrect)
  248.  
  249.         Dim leftbordergb As New LinearGradientBrush(leftborder, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Horizontal)
  250.         g.FillPath(leftbordergb, RoundRect(leftborder, 7))
  251.         g.DrawPath(New Pen(Brushes.Black), RoundRect(leftborder, 7))
  252.  
  253.         Dim rightbordergb As New LinearGradientBrush(rightborder, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Horizontal)
  254.         g.FillPath(rightbordergb, RoundRect(rightborder, 7))
  255.         g.DrawPath(New Pen(Brushes.Black), RoundRect(rightborder, 7))
  256.  
  257.         e.Graphics.DrawImage(b, New Point(0, 0))
  258.         g.Dispose() : b.Dispose()
  259.     End Sub
  260. End Class
  261.  
  262. Public Class FaderControlBox : Inherits Control
  263.     Dim _state As MouseState = MouseState.None
  264.     Dim _x As Integer
  265.     ReadOnly _minrect As New Rectangle(5, 2, 24, 24)
  266.     ReadOnly _maxrect As New Rectangle(32, 2, 24, 24)
  267.     ReadOnly _closerect As New Rectangle(59, 2, 24, 24)
  268.     ReadOnly _mintextrect As New Rectangle(5, 4, 24, 24)
  269.     ReadOnly _maxtextrect As New Rectangle(32, 4, 24, 24)
  270.     ReadOnly _closetextrect As New Rectangle(59, 4, 24, 24)
  271.  
  272.     Private _minDisable As Boolean = False
  273.     Public Property MinimumDisable As Boolean
  274.         Get
  275.             Return _minDisable
  276.         End Get
  277.         Set(value As Boolean)
  278.             _minDisable = value
  279.             Invalidate()
  280.         End Set
  281.     End Property
  282.  
  283.     Private _maxDisable As Boolean = False
  284.     Public Property MaximumDisable As Boolean
  285.         Get
  286.             Return _maxDisable
  287.         End Get
  288.         Set(value As Boolean)
  289.             _maxDisable = value
  290.             Invalidate()
  291.         End Set
  292.     End Property
  293.  
  294.     Protected Overrides Sub OnMouseDown(ByVal e As Windows.Forms.MouseEventArgs)
  295.         MyBase.OnMouseDown(e)
  296.  
  297.         If _x > 5 AndAlso _x < 29 Then
  298.             If MinimumDisable = False Then
  299.                 FindForm.WindowState = FormWindowState.Minimized
  300.             End If
  301.         ElseIf _x > 32 AndAlso _x < 56 Then
  302.             If MaximumDisable = False Then
  303.                 If FindForm.WindowState = FormWindowState.Maximized Then
  304.                     FindForm.WindowState = FormWindowState.Minimized
  305.                     FindForm.WindowState = FormWindowState.Normal
  306.                 Else
  307.                     FindForm.WindowState = FormWindowState.Minimized
  308.                     FindForm.WindowState = FormWindowState.Maximized
  309.                 End If
  310.             End If
  311.         ElseIf _x > 59 AndAlso _x < 83 Then
  312.             FindForm.Close()
  313.         End If
  314.  
  315.         _state = MouseState.Down : Invalidate()
  316.     End Sub
  317.  
  318.     Protected Overrides Sub OnMouseUp(ByVal e As Windows.Forms.MouseEventArgs)
  319.         MyBase.OnMouseUp(e)
  320.         _state = MouseState.Over : Invalidate()
  321.     End Sub
  322.  
  323.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  324.         MyBase.OnMouseEnter(e)
  325.         _state = MouseState.Over : Invalidate()
  326.     End Sub
  327.  
  328.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  329.         MyBase.OnMouseLeave(e)
  330.         _state = MouseState.None : Invalidate()
  331.     End Sub
  332.  
  333.     Protected Overrides Sub OnMouseMove(ByVal e As Windows.Forms.MouseEventArgs)
  334.         MyBase.OnMouseMove(e)
  335.         _x = e.Location.X
  336.         Invalidate()
  337.     End Sub
  338.  
  339.     Sub New()
  340.         MyBase.New()
  341.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  342.         DoubleBuffered = True
  343.         BackColor = Color.Transparent
  344.         Width = 85
  345.         Height = 30
  346.         Anchor = AnchorStyles.Top Or AnchorStyles.Right
  347.     End Sub
  348.  
  349.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  350.         Dim b As Bitmap = New Bitmap(Width, Height)
  351.         Dim g As Graphics = Graphics.FromImage(b)
  352.  
  353.         MyBase.OnPaint(e)
  354.         g.SmoothingMode = SmoothingMode.HighQuality
  355.  
  356.         Dim buttongb As New LinearGradientBrush(_minrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  357.         Dim buttonovergb As New LinearGradientBrush(_minrect, Color.FromArgb(81, 81, 81), Color.FromArgb(61, 61, 61), 90S)
  358.         g.FillRectangle(buttongb, _minrect)
  359.         g.DrawRectangle(Pens.Black, _minrect)
  360.         g.FillRectangle(buttongb, _maxrect)
  361.         g.DrawRectangle(Pens.Black, _maxrect)
  362.         g.FillRectangle(buttongb, _closerect)
  363.         g.DrawRectangle(Pens.Black, _closerect)
  364.  
  365.         g.DrawString("0", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _mintextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  366.         If FindForm.WindowState = FormWindowState.Maximized Then
  367.             g.DrawString("2", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  368.         Else
  369.             g.DrawString("1", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  370.         End If
  371.         g.DrawString("r", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _closetextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  372.  
  373.         Select Case _state
  374.             Case MouseState.None
  375.                 g.FillRectangle(buttongb, _minrect)
  376.                 g.DrawRectangle(Pens.Black, _minrect)
  377.                 g.FillRectangle(buttongb, _maxrect)
  378.                 g.DrawRectangle(Pens.Black, _maxrect)
  379.                 g.FillRectangle(buttongb, _closerect)
  380.                 g.DrawRectangle(Pens.Black, _closerect)
  381.  
  382.                 g.DrawString("0", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _mintextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  383.                 If FindForm.WindowState = FormWindowState.Maximized Then
  384.                     g.DrawString("2", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  385.                 Else
  386.                     g.DrawString("1", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  387.                 End If
  388.                 g.DrawString("r", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _closetextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  389.  
  390.             Case MouseState.Over
  391.                 If _x > 5 AndAlso _x < 29 Then
  392.                     If MinimumDisable = False Then
  393.                         g.FillRectangle(buttonovergb, _minrect)
  394.                         g.DrawRectangle(Pens.Black, _minrect)
  395.                         g.DrawString("0", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(255, 255, 255)), _mintextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  396.                     End If
  397.                 ElseIf _x > 32 AndAlso _x < 56 Then
  398.                     If MaximumDisable = False Then
  399.                         g.FillRectangle(buttonovergb, _maxrect)
  400.                         g.DrawRectangle(Pens.Black, _maxrect)
  401.                     End If
  402.  
  403.                     If FindForm.WindowState = FormWindowState.Maximized Then
  404.                         g.DrawString("2", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(255, 255, 255)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  405.                     Else
  406.                         g.DrawString("1", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(255, 255, 255)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  407.                     End If
  408.                 ElseIf _x > 59 AndAlso _x < 83 Then
  409.                     g.FillRectangle(buttonovergb, _closerect)
  410.                     g.DrawRectangle(Pens.Black, _closerect)
  411.                     g.DrawString("r", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(255, 255, 255)), _closetextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  412.                 End If
  413.             Case Else
  414.                 If MinimumDisable = False Then
  415.                     g.FillRectangle(buttonovergb, _minrect)
  416.                     g.DrawRectangle(Pens.Black, _minrect)
  417.                 End If
  418.  
  419.                 If MaximumDisable = False Then
  420.                     g.FillRectangle(buttonovergb, _maxrect)
  421.                     g.DrawRectangle(Pens.Black, _maxrect)
  422.                 End If
  423.                 g.FillRectangle(buttonovergb, _closerect)
  424.                 g.DrawRectangle(Pens.Black, _closerect)
  425.  
  426.                 g.DrawString("0", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _mintextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  427.                 If FindForm.WindowState = FormWindowState.Maximized Then
  428.                     g.DrawString("2", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  429.                 Else
  430.                     g.DrawString("1", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  431.                 End If
  432.                 g.DrawString("r", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _closetextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  433.         End Select
  434.  
  435.         e.Graphics.DrawImage(b, New Point(0, 0))
  436.         g.Dispose() : b.Dispose()
  437.     End Sub
  438. End Class
  439.  
  440. Public Class FaderRadioButton : Inherits Control
  441.     Dim _state As MouseState = MouseState.None
  442.     Private _check As Boolean
  443.     Public Property Checked As Boolean
  444.         Get
  445.             Return _check
  446.         End Get
  447.         Set(value As Boolean)
  448.             _check = value
  449.             Invalidate()
  450.         End Set
  451.     End Property
  452.  
  453.     Sub New()
  454.         MyBase.New()
  455.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  456.         BackColor = Color.Transparent
  457.         DoubleBuffered = True
  458.         Size = New Size(180, 25)
  459.     End Sub
  460.  
  461.     Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  462.         MyBase.OnTextChanged(e)
  463.         Invalidate()
  464.     End Sub
  465.  
  466.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  467.         If Not Checked Then Checked = True
  468.         For Each ctrl As FaderRadioButton In From ctrl1 In Parent.Controls.OfType(Of FaderRadioButton)() Where ctrl1.Handle <> Handle Where ctrl1.Enabled
  469.             ctrl.Checked = False
  470.         Next
  471.         MyBase.OnClick(e)
  472.     End Sub
  473.  
  474.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  475.         MyBase.OnMouseDown(e)
  476.         _state = MouseState.Down : Invalidate()
  477.     End Sub
  478.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  479.         MyBase.OnMouseUp(e)
  480.         _state = MouseState.Over : Invalidate()
  481.     End Sub
  482.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  483.         MyBase.OnMouseEnter(e)
  484.         _state = MouseState.Over : Invalidate()
  485.     End Sub
  486.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  487.         MyBase.OnMouseLeave(e)
  488.         _state = MouseState.None : Invalidate()
  489.     End Sub
  490.  
  491.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  492.         Dim b As Bitmap = New Bitmap(Width, Height)
  493.         Dim g As Graphics = Graphics.FromImage(b)
  494.  
  495.         Dim selectionrect As Rectangle = New Rectangle(3, 3, 18, 18)
  496.         Dim innerselectionrect As Rectangle = New Rectangle(4, 4, 17, 17)
  497.         Dim selectrect As Rectangle = New Rectangle(8, 8, 8, 8)
  498.  
  499.         MyBase.OnPaint(e)
  500.         g.SmoothingMode = SmoothingMode.HighQuality
  501.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  502.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  503.         g.Clear(BackColor)
  504.  
  505.         Select Case _state
  506.             Case MouseState.Over
  507.                 selectionrect.Inflate(1, 1)
  508.             Case MouseState.Down
  509.                 selectionrect.Inflate(-1, -1)
  510.         End Select
  511.  
  512.         g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(25, 4, Width, 16), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  513.  
  514.         If Checked Then
  515.             g.FillEllipse(New SolidBrush(Color.FromArgb(0, 0, 0)), selectionrect)
  516.             g.FillEllipse(New SolidBrush(Color.FromArgb(40, 37, 33)), innerselectionrect)
  517.             g.FillEllipse(New SolidBrush(Color.FromArgb(245, 245, 245)), selectrect)
  518.         Else
  519.             g.FillEllipse(New SolidBrush(Color.FromArgb(0, 0, 0)), selectionrect)
  520.             g.FillEllipse(New SolidBrush(Color.FromArgb(40, 37, 33)), innerselectionrect)
  521.         End If
  522.  
  523.         e.Graphics.DrawImage(b, New Point(0, 0))
  524.         g.Dispose() : b.Dispose()
  525.     End Sub
  526. End Class
  527.  
  528. Public Class FaderCheckBox : Inherits Control
  529.     Dim _state As MouseState = MouseState.None
  530.  
  531.     Private _check As Boolean
  532.     Public Property Checked As Boolean
  533.         Get
  534.             Return _check
  535.         End Get
  536.         Set(value As Boolean)
  537.             _check = value
  538.             Invalidate()
  539.         End Set
  540.     End Property
  541.  
  542.     Sub New()
  543.         MyBase.New()
  544.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  545.         BackColor = Color.Transparent
  546.         DoubleBuffered = True
  547.         Size = New Size(180, 25)
  548.     End Sub
  549.  
  550.     Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  551.         MyBase.OnTextChanged(e)
  552.         Invalidate()
  553.     End Sub
  554.  
  555.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  556.         If Not Checked Then Checked = True Else Checked = False
  557.         MyBase.OnClick(e)
  558.     End Sub
  559.  
  560.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  561.         MyBase.OnMouseDown(e)
  562.         _state = MouseState.Down : Invalidate()
  563.     End Sub
  564.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  565.         MyBase.OnMouseUp(e)
  566.         _state = MouseState.Over : Invalidate()
  567.     End Sub
  568.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  569.         MyBase.OnMouseEnter(e)
  570.         _state = MouseState.Over : Invalidate()
  571.     End Sub
  572.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  573.         MyBase.OnMouseLeave(e)
  574.         _state = MouseState.None : Invalidate()
  575.     End Sub
  576.  
  577.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  578.         Dim b As Bitmap = New Bitmap(Width, Height)
  579.         Dim g As Graphics = Graphics.FromImage(b)
  580.  
  581.         Dim selectionrect As Rectangle = New Rectangle(3, 3, 18, 18)
  582.         Dim innerselectionrect As Rectangle = New Rectangle(4, 4, 17, 17)
  583.         Dim selectrect As Rectangle = New Rectangle(6, 6, 15, 15)
  584.  
  585.         MyBase.OnPaint(e)
  586.         g.SmoothingMode = SmoothingMode.HighQuality
  587.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  588.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  589.         g.Clear(BackColor)
  590.  
  591.         Select Case _state
  592.             Case MouseState.Over
  593.                 selectionrect.Inflate(1, 1)
  594.             Case MouseState.Down
  595.                 selectionrect.Inflate(-1, -1)
  596.         End Select
  597.  
  598.         g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(25, 4, Width, 16), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  599.  
  600.         If Checked Then
  601.             g.FillRectangle(New SolidBrush(Color.FromArgb(0, 0, 0)), selectionrect)
  602.             g.FillRectangle(New SolidBrush(Color.FromArgb(40, 37, 33)), innerselectionrect)
  603.             g.DrawString("b", New Font("Marlett", 15, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), selectrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  604.         Else
  605.             g.FillRectangle(New SolidBrush(Color.FromArgb(0, 0, 0)), selectionrect)
  606.             g.FillRectangle(New SolidBrush(Color.FromArgb(40, 37, 33)), innerselectionrect)
  607.         End If
  608.  
  609.         e.Graphics.DrawImage(b, New Point(0, 0))
  610.         g.Dispose() : b.Dispose()
  611.     End Sub
  612. End Class
  613.  
  614. Public Class FaderButton : Inherits Control
  615.     Dim _state As MouseState
  616.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  617.         MyBase.OnMouseDown(e)
  618.         _state = MouseState.Down
  619.         Invalidate()
  620.     End Sub
  621.  
  622.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  623.         MyBase.OnMouseUp(e)
  624.         _state = MouseState.Over
  625.         Invalidate()
  626.     End Sub
  627.  
  628.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  629.         MyBase.OnMouseEnter(e)
  630.         _state = MouseState.Over
  631.         Invalidate()
  632.     End Sub
  633.  
  634.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  635.         MyBase.OnMouseLeave(e)
  636.         _state = MouseState.None
  637.         Invalidate()
  638.     End Sub
  639.  
  640.     Sub New()
  641.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  642.         BackColor = Color.Transparent
  643.         DoubleBuffered = True
  644.         Size = New Size(160, 35)
  645.         _state = MouseState.None
  646.     End Sub
  647.  
  648.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  649.         Dim b As Bitmap = New Bitmap(Width, Height)
  650.         Dim g As Graphics = Graphics.FromImage(b)
  651.  
  652.         Dim bodyrect As Rectangle = New Rectangle(1, 5, Width - 3, Height - 11)
  653.         Dim topborderrect As Rectangle = New Rectangle(0, 0, Width - 1, 5)
  654.         Dim bottomborderrect As Rectangle = New Rectangle(0, Height - 6, Width - 1, 5)
  655.         Dim btnfont As New Font("Segoe UI", 11, FontStyle.Bold)
  656.  
  657.         MyBase.OnPaint(e)
  658.         g.SmoothingMode = SmoothingMode.HighQuality
  659.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  660.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  661.         g.Clear(BackColor)
  662.  
  663.         Dim bodyrectgb As New LinearGradientBrush(bodyrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), LinearGradientMode.Vertical)
  664.         g.FillRectangle(bodyrectgb, bodyrect)
  665.         g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  666.  
  667.         Dim topborderrectgb As New LinearGradientBrush(topborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  668.         g.FillRectangle(topborderrectgb, topborderrect)
  669.         g.DrawRectangle(New Pen(Brushes.Black), topborderrect)
  670.  
  671.         Dim bottomborderrectgb As New LinearGradientBrush(bottomborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  672.         g.FillRectangle(bottomborderrectgb, bottomborderrect)
  673.         g.DrawRectangle(New Pen(Brushes.Black), bottomborderrect)
  674.  
  675.         Select Case _state
  676.             Case MouseState.None
  677.                 Dim bodyrectnonegb As New LinearGradientBrush(bodyrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), LinearGradientMode.Vertical)
  678.                 g.FillRectangle(bodyrectnonegb, bodyrect)
  679.                 g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  680.  
  681.                 Dim topborderrectnonegb As New LinearGradientBrush(topborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  682.                 g.FillRectangle(topborderrectnonegb, topborderrect)
  683.                 g.DrawRectangle(New Pen(Brushes.Black), topborderrect)
  684.  
  685.                 Dim bottomborderrectnonegb As New LinearGradientBrush(bottomborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  686.                 g.FillRectangle(bottomborderrectnonegb, bottomborderrect)
  687.                 g.DrawRectangle(New Pen(Brushes.Black), bottomborderrect)
  688.                 g.DrawString(Text, btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  689.             Case MouseState.Down
  690.                 g.TranslateTransform(1, 1)
  691.                 g.DrawString(Text, btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  692.             Case MouseState.Over
  693.                 Dim bodyrectovergb As New LinearGradientBrush(bodyrect, Color.FromArgb(41, 41, 41), Color.FromArgb(61, 61, 61), LinearGradientMode.Vertical)
  694.                 g.FillRectangle(bodyrectovergb, bodyrect)
  695.                 g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  696.                 g.DrawString(Text, btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  697.         End Select
  698.  
  699.         e.Graphics.DrawImage(b, New Point(0, 0))
  700.         g.Dispose() : b.Dispose()
  701.     End Sub
  702. End Class
  703.  
  704. Public Class FaderPanel : Inherits ContainerControl
  705.  
  706.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  707.         MyBase.OnResize(e)
  708.         Invalidate()
  709.     End Sub
  710.  
  711.     Sub New()
  712.         MyBase.New()
  713.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  714.         BackColor = Color.Transparent
  715.         DoubleBuffered = True
  716.         Size = New Size(240, 160)
  717.     End Sub
  718.  
  719.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  720.         Dim b As Bitmap = New Bitmap(Width, Height)
  721.         Dim g As Graphics = Graphics.FromImage(b)
  722.  
  723.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  724.  
  725.         MyBase.OnPaint(e)
  726.         g.SmoothingMode = SmoothingMode.HighQuality
  727.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  728.         g.Clear(BackColor)
  729.  
  730.         Dim panelgb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  731.         g.FillRectangle(panelgb, rect)
  732.         g.DrawRectangle(New Pen(Brushes.Black, 2), rect)
  733.  
  734.         e.Graphics.DrawImage(b, New Point(0, 0))
  735.         g.Dispose() : b.Dispose()
  736.     End Sub
  737. End Class
  738.  
  739. Public Class FaderGroupBox : Inherits ContainerControl
  740.     Private _showHeader As Boolean = True
  741.     Public Property ShowHeader() As Boolean
  742.         Get
  743.             Return _showHeader
  744.         End Get
  745.         Set(ByVal v As Boolean)
  746.             _showHeader = v
  747.             Invalidate()
  748.         End Set
  749.     End Property
  750.  
  751.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  752.         MyBase.OnResize(e)
  753.         Invalidate()
  754.     End Sub
  755.  
  756.     Sub New()
  757.         MyBase.New()
  758.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  759.         BackColor = Color.Transparent
  760.         DoubleBuffered = True
  761.         Size = New Size(240, 160)
  762.     End Sub
  763.  
  764.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  765.         Dim b As Bitmap = New Bitmap(Width, Height)
  766.         Dim g As Graphics = Graphics.FromImage(b)
  767.  
  768.         Dim underlinepen As New Pen(Color.FromArgb(255, 255, 255), 2)
  769.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  770.  
  771.         MyBase.OnPaint(e)
  772.         g.SmoothingMode = SmoothingMode.HighQuality
  773.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  774.         g.Clear(BackColor)
  775.  
  776.         Dim groupgb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  777.         g.FillRectangle(groupgb, rect)
  778.         g.DrawRectangle(New Pen(Brushes.Black, 2), rect)
  779.  
  780.         If _showHeader Then
  781.             g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(0, 3, Width - 1, 30), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  782.             g.DrawLine(underlinepen, 10, 30, Width - 11, 30)
  783.         End If
  784.  
  785.         e.Graphics.DrawImage(b, New Point(0, 0))
  786.         g.Dispose() : b.Dispose()
  787.     End Sub
  788. End Class
  789.  
  790. Public Class FaderProgressBar : Inherits Control
  791.     Private _val As Integer
  792.     Public Property Value() As Integer
  793.         Get
  794.             Return _val
  795.         End Get
  796.         Set(ByVal v As Integer)
  797.             If v > _max Then
  798.                 _val = _max
  799.             ElseIf v < 0 Then
  800.                 _val = 0
  801.             Else
  802.                 _val = v
  803.             End If
  804.             Invalidate()
  805.         End Set
  806.     End Property
  807.  
  808.     Private _max As Integer
  809.     Public Property Maximum() As Integer
  810.         Get
  811.             Return _max
  812.         End Get
  813.         Set(ByVal v As Integer)
  814.             If v < 1 Then
  815.                 _max = 1
  816.             Else
  817.                 _max = v
  818.             End If
  819.             If v < _val Then
  820.                 _val = _max
  821.             End If
  822.             Invalidate()
  823.         End Set
  824.     End Property
  825.  
  826.     Private _showPercentage As Boolean = False
  827.     Public Property ShowPercentage() As Boolean
  828.         Get
  829.             Return _showPercentage
  830.         End Get
  831.         Set(ByVal v As Boolean)
  832.             _showPercentage = v
  833.             Invalidate()
  834.         End Set
  835.     End Property
  836.  
  837.     Sub New()
  838.         MyBase.New()
  839.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  840.         BackColor = Color.Transparent
  841.         Size = New Size(250, 20)
  842.         DoubleBuffered = True
  843.         _max = 100
  844.     End Sub
  845.  
  846.     Protected Overrides Sub OnPaint(e As Windows.Forms.PaintEventArgs)
  847.         Dim b As Bitmap = New Bitmap(Width, Height)
  848.         Dim g As Graphics = Graphics.FromImage(b)
  849.  
  850.         Dim percent As Integer = CInt((Width - 1) * (_val / _max))
  851.         Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  852.         Dim innerrect As Rectangle = New Rectangle(4, 4, percent - 9, Height - 9)
  853.  
  854.         MyBase.OnPaint(e)
  855.         g.Clear(BackColor)
  856.         g.SmoothingMode = SmoothingMode.HighQuality
  857.         g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(outerrect, 5))
  858.         g.DrawPath(New Pen(Color.FromArgb(0, 0, 0), 2), RoundRect(outerrect, 5))
  859.  
  860.         If percent <> 0 Then
  861.             g.FillPath(New SolidBrush(Color.FromArgb(128, 128, 128)), RoundRect(innerrect, 7))
  862.         End If
  863.  
  864.         If _showPercentage Then
  865.             g.DrawString(String.Format("{0}%", _val), New Font("Segoe UI", 10, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(10, 1, Width - 1, Height - 1), New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  866.         End If
  867.  
  868.         e.Graphics.DrawImage(b, New Point(0, 0))
  869.         g.Dispose() : b.Dispose()
  870.     End Sub
  871. End Class
  872.  
  873. Public Class FaderLabel : Inherits Control
  874.     Private _border As Boolean = True
  875.     Public Property Border As Boolean
  876.         Get
  877.             Return _border
  878.         End Get
  879.         Set(value As Boolean)
  880.             _border = value
  881.             Invalidate()
  882.         End Set
  883.     End Property
  884.  
  885.     Sub New()
  886.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  887.         BackColor = Color.Transparent
  888.         DoubleBuffered = True
  889.         Size = New Size(150, 30)
  890.     End Sub
  891.  
  892.     Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  893.         Dim b As Bitmap = New Bitmap(Width, Height)
  894.         Dim g As Graphics = Graphics.FromImage(b)
  895.  
  896.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  897.  
  898.         MyBase.OnPaint(e)
  899.         g.Clear(BackColor)
  900.         g.SmoothingMode = SmoothingMode.HighQuality
  901.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  902.         g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(rect, 5))
  903.  
  904.         If Border = True Then
  905.             g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(rect, 5))
  906.             g.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 2), RoundRect(rect, 5))
  907.         End If
  908.  
  909.         g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(255, 255, 255)), rect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  910.  
  911.         e.Graphics.DrawImage(b, New Point(0, 0))
  912.         g.Dispose() : b.Dispose()
  913.     End Sub
  914. End Class
  915.  
  916. Public Class FaderToggle : Inherits Control
  917.     Private _check As Boolean
  918.     Public Property Checked As Boolean
  919.         Get
  920.             Return _check
  921.         End Get
  922.         Set(value As Boolean)
  923.             _check = value
  924.             Invalidate()
  925.         End Set
  926.     End Property
  927.  
  928.     Sub New()
  929.         MyBase.New()
  930.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  931.         DoubleBuffered = True
  932.         BackColor = Color.Transparent
  933.         Size = New Size(80, 25)
  934.     End Sub
  935.  
  936.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  937.         If Not Checked Then Checked = True Else Checked = False
  938.         MyBase.OnClick(e)
  939.     End Sub
  940.  
  941.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  942.         Dim b As Bitmap = New Bitmap(Width, Height)
  943.         Dim g As Graphics = Graphics.FromImage(b)
  944.  
  945.         Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  946.  
  947.         MyBase.OnPaint(e)
  948.         g.Clear(BackColor)
  949.         g.SmoothingMode = SmoothingMode.HighQuality
  950.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  951.         g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(outerrect, 5))
  952.         g.DrawPath(New Pen(Color.FromArgb(0, 0, 0), 2), RoundRect(outerrect, 5))
  953.  
  954.         If Checked Then
  955.             g.FillPath(New SolidBrush(Color.FromArgb(128, 128, 128)), RoundRect(New Rectangle(3, 3, CInt((Width / 2) - 3), Height - 7), 3))
  956.             g.DrawString("ON", New Font("Segoe UI", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(0, 0, 0)), New Rectangle(2, 3, CInt((Width / 2) - 1), Height - 5), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  957.         Else
  958.             g.FillPath(New SolidBrush(Color.FromArgb(128, 128, 128)), RoundRect(New Rectangle(CInt((Width / 2) - 2), 3, CInt((Width / 2) - 2), Height - 7), 3))
  959.             g.DrawString("OFF", New Font("Segoe UI", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(0, 0, 0)), New Rectangle(CInt((Width / 2) - 2), 3, CInt((Width / 2) - 1), Height - 5), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  960.         End If
  961.  
  962.         e.Graphics.DrawImage(b, New Point(0, 0))
  963.         g.Dispose() : b.Dispose()
  964.     End Sub
  965. End Class
  966.  
  967. Public Class FaderVerticalProgressBar : Inherits Control
  968.     Private _val As Integer
  969.     Public Property Value() As Integer
  970.         Get
  971.             Return _val
  972.         End Get
  973.         Set(ByVal v As Integer)
  974.             If v > _max Then
  975.                 _val = _max
  976.             ElseIf v < 0 Then
  977.                 _val = 0
  978.             Else
  979.                 _val = v
  980.             End If
  981.             Invalidate()
  982.         End Set
  983.     End Property
  984.  
  985.     Private _max As Integer
  986.     Public Property Maximum() As Integer
  987.         Get
  988.             Return _max
  989.         End Get
  990.         Set(ByVal v As Integer)
  991.             If v < 1 Then
  992.                 _max = 1
  993.             Else
  994.                 _max = v
  995.             End If
  996.             If v < _val Then
  997.                 _val = _max
  998.             End If
  999.             Invalidate()
  1000.         End Set
  1001.     End Property
  1002.  
  1003.     Private _showPercentage As Boolean = False
  1004.     Public Property ShowPercentage() As Boolean
  1005.         Get
  1006.             Return _showPercentage
  1007.         End Get
  1008.         Set(ByVal v As Boolean)
  1009.             _showPercentage = v
  1010.             Invalidate()
  1011.         End Set
  1012.     End Property
  1013.  
  1014.     Sub New()
  1015.         MyBase.New()
  1016.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1017.         BackColor = Color.Transparent
  1018.         Size = New Size(20, 250)
  1019.         DoubleBuffered = True
  1020.         _max = 100
  1021.     End Sub
  1022.  
  1023.     Protected Overrides Sub OnPaint(e As Windows.Forms.PaintEventArgs)
  1024.         Dim b As Bitmap = New Bitmap(Width, Height)
  1025.         Dim g As Graphics = Graphics.FromImage(b)
  1026.  
  1027.         Dim percent As Integer = CInt((Height - 1) * (_val / _max))
  1028.         Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1029.         Dim innerrect As Rectangle = New Rectangle(4, (Height - percent) + 4, Width - 9, percent - 9)
  1030.  
  1031.         MyBase.OnPaint(e)
  1032.         g.Clear(BackColor)
  1033.         g.SmoothingMode = SmoothingMode.HighQuality
  1034.         g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(outerrect, 5))
  1035.         g.DrawPath(New Pen(Color.FromArgb(0, 0, 0)), RoundRect(outerrect, 5))
  1036.  
  1037.         If percent <> 0 Then
  1038.             Try
  1039.                 g.FillPath(New SolidBrush(Color.FromArgb(128, 128, 128)), RoundRect(innerrect, 7))
  1040.             Catch : End Try
  1041.         End If
  1042.  
  1043.         If _showPercentage Then
  1044.             g.DrawString(String.Format("{0}%", _val), New Font("Segoe UI", 8, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), outerrect, New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1045.         End If
  1046.  
  1047.         e.Graphics.DrawImage(b, New Point(0, 0))
  1048.         g.Dispose() : b.Dispose()
  1049.     End Sub
  1050. End Class
  1051.  
  1052. Public Class FaderHorizontalSeperator : Inherits Control
  1053.     Sub New()
  1054.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1055.         DoubleBuffered = True
  1056.         BackColor = Color.Transparent
  1057.         Size = New Size(200, 3)
  1058.     End Sub
  1059.  
  1060.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  1061.         MyBase.OnResize(e)
  1062.         Height = 3
  1063.     End Sub
  1064.  
  1065.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1066.         Dim b As Bitmap = New Bitmap(Width, Height)
  1067.         Dim g As Graphics = Graphics.FromImage(b)
  1068.  
  1069.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1070.  
  1071.         MyBase.OnPaint(e)
  1072.         g.Clear(BackColor)
  1073.         g.SmoothingMode = SmoothingMode.HighQuality
  1074.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  1075.         g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(rect, 2))
  1076.         g.DrawPath(New Pen(Color.FromArgb(0, 0, 0)), RoundRect(rect, 2))
  1077.  
  1078.         e.Graphics.DrawImage(b, New Point(0, 0))
  1079.         g.Dispose() : b.Dispose()
  1080.     End Sub
  1081. End Class
  1082.  
  1083. Public Class FaderVerticalSeperator : Inherits Control
  1084.     Sub New()
  1085.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1086.         DoubleBuffered = True
  1087.         BackColor = Color.Transparent
  1088.         Size = New Size(3, 200)
  1089.     End Sub
  1090.  
  1091.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  1092.         MyBase.OnResize(e)
  1093.         Width = 3
  1094.     End Sub
  1095.  
  1096.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1097.         Dim b As Bitmap = New Bitmap(Width, Height)
  1098.         Dim g As Graphics = Graphics.FromImage(b)
  1099.  
  1100.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1101.  
  1102.         MyBase.OnPaint(e)
  1103.         g.Clear(BackColor)
  1104.         g.SmoothingMode = SmoothingMode.HighQuality
  1105.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  1106.         g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(rect, 2))
  1107.         g.DrawPath(New Pen(Color.FromArgb(0, 0, 0)), RoundRect(rect, 2))
  1108.  
  1109.         e.Graphics.DrawImage(b, New Point(0, 0))
  1110.         g.Dispose() : b.Dispose()
  1111.     End Sub
  1112. End Class
  1113.  
  1114. Public Class FaderProgressButton : Inherits Control
  1115.     Dim _state As MouseState
  1116.     Private _val As Integer
  1117.     Public Property Value() As Integer
  1118.         Get
  1119.             Return _val
  1120.         End Get
  1121.         Set(ByVal v As Integer)
  1122.             If v > _max Then
  1123.                 _val = _max
  1124.             ElseIf v < 0 Then
  1125.                 _val = 0
  1126.             Else
  1127.                 _val = v
  1128.             End If
  1129.             Invalidate()
  1130.         End Set
  1131.     End Property
  1132.  
  1133.     Private _max As Integer
  1134.     Public Property Maximum() As Integer
  1135.         Get
  1136.             Return _max
  1137.         End Get
  1138.         Set(ByVal v As Integer)
  1139.             If v < 1 Then
  1140.                 _max = 1
  1141.             Else
  1142.                 _max = v
  1143.             End If
  1144.             If v < _val Then
  1145.                 _val = _max
  1146.             End If
  1147.             Invalidate()
  1148.         End Set
  1149.     End Property
  1150.  
  1151.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1152.         MyBase.OnMouseDown(e)
  1153.         _state = MouseState.Down
  1154.         Invalidate()
  1155.     End Sub
  1156.  
  1157.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1158.         MyBase.OnMouseUp(e)
  1159.         _state = MouseState.Over
  1160.         Invalidate()
  1161.     End Sub
  1162.  
  1163.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  1164.         MyBase.OnMouseEnter(e)
  1165.         _state = MouseState.Over
  1166.         Invalidate()
  1167.     End Sub
  1168.  
  1169.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1170.         MyBase.OnMouseLeave(e)
  1171.         _state = MouseState.None
  1172.         Invalidate()
  1173.     End Sub
  1174.     Sub New()
  1175.         MyBase.New()
  1176.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1177.         BackColor = Color.Transparent
  1178.         Size = New Size(160, 50)
  1179.         DoubleBuffered = True
  1180.         _max = 100
  1181.     End Sub
  1182.  
  1183.     Protected Overrides Sub OnPaint(e As Windows.Forms.PaintEventArgs)
  1184.         Dim b As Bitmap = New Bitmap(Width, Height)
  1185.         Dim g As Graphics = Graphics.FromImage(b)
  1186.  
  1187.         Dim percent As Integer = CInt((Width - 1) * (_val / _max))
  1188.         Dim bodyrect As Rectangle = New Rectangle(1, 5, Width - 3, Height - 11)
  1189.         Dim topborderrect As Rectangle = New Rectangle(0, 0, Width - 1, 5)
  1190.         Dim bottomborderrect As Rectangle = New Rectangle(0, Height - 6, Width - 1, 5)
  1191.         Dim progressinnerrect As Rectangle = New Rectangle(1, 5, percent - 3, Height - 11)
  1192.         Dim btnfont As New Font("Segoe UI", 11, FontStyle.Bold)
  1193.  
  1194.         MyBase.OnPaint(e)
  1195.         g.SmoothingMode = SmoothingMode.HighQuality
  1196.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  1197.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1198.         g.Clear(BackColor)
  1199.  
  1200.         Dim bodyrectgb As New LinearGradientBrush(bodyrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), LinearGradientMode.Vertical)
  1201.         g.FillRectangle(bodyrectgb, bodyrect)
  1202.         g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  1203.  
  1204.         Dim topborderrectgb As New LinearGradientBrush(topborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  1205.         g.FillRectangle(topborderrectgb, topborderrect)
  1206.         g.DrawRectangle(New Pen(Brushes.Black), topborderrect)
  1207.  
  1208.         Dim bottomborderrectgb As New LinearGradientBrush(bottomborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  1209.         g.FillRectangle(bottomborderrectgb, bottomborderrect)
  1210.         g.DrawRectangle(New Pen(Brushes.Black), bottomborderrect)
  1211.  
  1212.         Select Case _state
  1213.             Case MouseState.None
  1214.                 Dim bodyrectnonegb As New LinearGradientBrush(bodyrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), LinearGradientMode.Vertical)
  1215.                 g.FillRectangle(bodyrectnonegb, bodyrect)
  1216.                 g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  1217.  
  1218.                 Dim topborderrectnonegb As New LinearGradientBrush(topborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  1219.                 g.FillRectangle(topborderrectnonegb, topborderrect)
  1220.                 g.DrawRectangle(New Pen(Brushes.Black), topborderrect)
  1221.  
  1222.                 Dim bottomborderrectnonegb As New LinearGradientBrush(bottomborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  1223.                 g.FillRectangle(bottomborderrectnonegb, bottomborderrect)
  1224.                 g.DrawRectangle(New Pen(Brushes.Black), bottomborderrect)
  1225.  
  1226.                 g.DrawString(Text, btnfont, Brushes.White, bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1227.             Case MouseState.Down
  1228.                 g.TranslateTransform(1, 1)
  1229.                 g.DrawString(Text, btnfont, Brushes.White, bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1230.             Case MouseState.Over
  1231.                 Dim bodyrectovergb As New LinearGradientBrush(bodyrect, Color.FromArgb(41, 41, 41), Color.FromArgb(61, 61, 61), LinearGradientMode.Vertical)
  1232.                 g.FillRectangle(bodyrectovergb, bodyrect)
  1233.                 g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  1234.                 g.DrawString(Text, btnfont, Brushes.White, bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1235.         End Select
  1236.  
  1237.         If percent <> 0 Then
  1238.             Dim progressgb As New LinearGradientBrush(progressinnerrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 180S)
  1239.             g.FillPath(progressgb, RoundRect(progressinnerrect, 3))
  1240.             g.DrawPath(New Pen(Color.FromArgb(0, 0, 0)), RoundRect(progressinnerrect, 3))
  1241.             g.DrawString(Text, btnfont, Brushes.White, bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1242.         End If
  1243.  
  1244.         e.Graphics.DrawImage(b, New Point(0, 0))
  1245.         g.Dispose() : b.Dispose()
  1246.     End Sub
  1247. End Class
  1248.  
  1249. Public Class FaderTabControl : Inherits TabControl
  1250.  
  1251.     Sub New()
  1252.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1253.         BackColor = Color.Transparent
  1254.         DoubleBuffered = True
  1255.         ItemSize = New Size(100, 35)
  1256.     End Sub
  1257.  
  1258.     Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  1259.         Dim b As Bitmap = New Bitmap(Width, Height)
  1260.         Dim g As Graphics = Graphics.FromImage(b)
  1261.  
  1262.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1263.         Dim selectedtabgb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  1264.         Dim nonselectedtabgb As New LinearGradientBrush(rect, Color.FromArgb(81, 81, 81), Color.FromArgb(61, 61, 61), 90S)
  1265.  
  1266.         Try : SelectedTab.BackColor = Color.FromArgb(61, 61, 61) : Catch : End Try
  1267.  
  1268.         MyBase.OnPaint(e)
  1269.         g.Clear(BackColor)
  1270.         g.FillRectangle(selectedtabgb, rect)
  1271.         g.DrawRectangle(New Pen(Brushes.Black, 2), rect)
  1272.  
  1273.         For i = 0 To TabCount - 1
  1274.             Dim textRectangle As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 1, GetTabRect(i).Location.Y), New Size(GetTabRect(i).Width - 1, GetTabRect(i).Height))
  1275.             If i = SelectedIndex Then
  1276.                 Dim tabrect As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 1, GetTabRect(i).Location.Y + 1), New Size(GetTabRect(i).Width - 1, GetTabRect(i).Height - 2))
  1277.                 g.FillPath(selectedtabgb, RoundRect(tabrect, 2))
  1278.                 g.DrawPath(New Pen(Brushes.Black), RoundRect(tabrect, 2))
  1279.                 g.DrawString(TabPages(i).Text, New Font("Segoe UI", 10, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), textRectangle, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1280.             Else
  1281.                 Dim tabrect As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 1, GetTabRect(i).Location.Y + 4), New Size(GetTabRect(i).Width - 1, GetTabRect(i).Height - 5))
  1282.                 g.FillPath(nonselectedtabgb, RoundRect(tabrect, 2))
  1283.                 g.DrawPath(New Pen(Brushes.Black), RoundRect(tabrect, 2))
  1284.                 g.DrawString(TabPages(i).Text, New Font("Segoe UI", 10, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), textRectangle, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1285.             End If
  1286.         Next
  1287.  
  1288.         e.Graphics.DrawImage(b, New Point(0, 0))
  1289.         g.Dispose() : b.Dispose()
  1290.     End Sub
  1291. End Class
  1292.  
  1293. Public Class FaderVerticalTabControl : Inherits TabControl
  1294.  
  1295.     Sub New()
  1296.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1297.         BackColor = Color.Transparent
  1298.         DoubleBuffered = True
  1299.         SizeMode = TabSizeMode.Fixed
  1300.         Alignment = TabAlignment.Left
  1301.         ItemSize = New Size(35, 100)
  1302.     End Sub
  1303.  
  1304.     Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  1305.         Dim b As Bitmap = New Bitmap(Width, Height)
  1306.         Dim g As Graphics = Graphics.FromImage(b)
  1307.  
  1308.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1309.         Dim selectedtabgb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  1310.         Dim nonselectedtabgb As New LinearGradientBrush(rect, Color.FromArgb(81, 81, 81), Color.FromArgb(61, 61, 61), 90S)
  1311.  
  1312.         Try : SelectedTab.BackColor = Color.FromArgb(61, 61, 61) : Catch : End Try
  1313.  
  1314.         MyBase.OnPaint(e)
  1315.         g.Clear(BackColor)
  1316.         g.FillRectangle(selectedtabgb, rect)
  1317.         g.DrawRectangle(New Pen(Brushes.Black, 2), rect)
  1318.  
  1319.         For i = 0 To TabCount - 1
  1320.             Dim textRectangle As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 1, GetTabRect(i).Location.Y), New Size(GetTabRect(i).Width - 1, GetTabRect(i).Height))
  1321.             If i = SelectedIndex Then
  1322.                 Dim tabrect As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 1, GetTabRect(i).Location.Y + 1), New Size(GetTabRect(i).Width - 1, GetTabRect(i).Height - 1))
  1323.                 g.FillPath(selectedtabgb, RoundRect(tabrect, 2))
  1324.                 g.DrawPath(New Pen(Brushes.Black), RoundRect(tabrect, 2))
  1325.                 g.DrawString(TabPages(i).Text, New Font("Segoe UI", 10, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), textRectangle, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1326.             Else
  1327.                 Dim tabrect As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 4, GetTabRect(i).Location.Y + 1), New Size(GetTabRect(i).Width - 4, GetTabRect(i).Height - 1))
  1328.                 g.FillPath(nonselectedtabgb, RoundRect(tabrect, 2))
  1329.                 g.DrawPath(New Pen(Brushes.Black), RoundRect(tabrect, 2))
  1330.                 g.DrawString(TabPages(i).Text, New Font("Segoe UI", 10, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), textRectangle, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1331.             End If
  1332.         Next
  1333.  
  1334.         e.Graphics.DrawImage(b, New Point(0, 0))
  1335.         g.Dispose() : b.Dispose()
  1336.     End Sub
  1337. End Class
  1338.  
  1339. Public Class FaderTextBox : Inherits Control
  1340.     Dim WithEvents _tb As New TextBox
  1341.     Private _allowpassword As Boolean = False
  1342.     Public Shadows Property UseSystemPasswordChar() As Boolean
  1343.         Get
  1344.             Return _allowpassword
  1345.         End Get
  1346.         Set(ByVal value As Boolean)
  1347.             _tb.UseSystemPasswordChar = UseSystemPasswordChar
  1348.             _allowpassword = value
  1349.             Invalidate()
  1350.         End Set
  1351.     End Property
  1352.  
  1353.     Private _maxChars As Integer = 32767
  1354.     Public Shadows Property MaxLength() As Integer
  1355.         Get
  1356.             Return _maxChars
  1357.         End Get
  1358.         Set(ByVal value As Integer)
  1359.             _maxChars = value
  1360.             _tb.MaxLength = MaxLength
  1361.             Invalidate()
  1362.         End Set
  1363.     End Property
  1364.  
  1365.     Private _textAlignment As HorizontalAlignment
  1366.     Public Shadows Property TextAlign() As HorizontalAlignment
  1367.         Get
  1368.             Return _textAlignment
  1369.         End Get
  1370.         Set(ByVal value As HorizontalAlignment)
  1371.             _textAlignment = value
  1372.             Invalidate()
  1373.         End Set
  1374.     End Property
  1375.  
  1376.     Private _multiLine As Boolean = False
  1377.     Public Shadows Property MultiLine() As Boolean
  1378.         Get
  1379.             Return _multiLine
  1380.         End Get
  1381.         Set(ByVal value As Boolean)
  1382.             _multiLine = value
  1383.             _tb.Multiline = value
  1384.             OnResize(EventArgs.Empty)
  1385.             Invalidate()
  1386.         End Set
  1387.     End Property
  1388.  
  1389.     Private _readOnly As Boolean = False
  1390.     Public Shadows Property [ReadOnly]() As Boolean
  1391.         Get
  1392.             Return _readOnly
  1393.         End Get
  1394.         Set(ByVal value As Boolean)
  1395.             _readOnly = value
  1396.             If _tb IsNot Nothing Then
  1397.                 _tb.ReadOnly = value
  1398.             End If
  1399.         End Set
  1400.     End Property
  1401.  
  1402.     Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  1403.         MyBase.OnTextChanged(e)
  1404.         Invalidate()
  1405.     End Sub
  1406.  
  1407.     Protected Overrides Sub OnBackColorChanged(ByVal e As EventArgs)
  1408.         MyBase.OnBackColorChanged(e)
  1409.         Invalidate()
  1410.     End Sub
  1411.  
  1412.     Protected Overrides Sub OnForeColorChanged(ByVal e As EventArgs)
  1413.         MyBase.OnForeColorChanged(e)
  1414.         _tb.ForeColor = ForeColor
  1415.         Invalidate()
  1416.     End Sub
  1417.  
  1418.     Protected Overrides Sub OnFontChanged(ByVal e As EventArgs)
  1419.         MyBase.OnFontChanged(e)
  1420.         _tb.Font = Font
  1421.     End Sub
  1422.  
  1423.     Protected Overrides Sub OnGotFocus(ByVal e As EventArgs)
  1424.         MyBase.OnGotFocus(e)
  1425.         _tb.Focus()
  1426.     End Sub
  1427.  
  1428.     Private Sub TextChangeTb() Handles _tb.TextChanged
  1429.         Text = _tb.Text
  1430.     End Sub
  1431.  
  1432.     Private Sub TextChng() Handles MyBase.TextChanged
  1433.         _tb.Text = Text
  1434.     End Sub
  1435.  
  1436.     Public Sub NewTextBox()
  1437.         With _tb
  1438.             .Text = String.Empty
  1439.             .BackColor = Color.FromArgb(61, 61, 61)
  1440.             .ForeColor = ForeColor
  1441.             .TextAlign = HorizontalAlignment.Center
  1442.             .BorderStyle = BorderStyle.None
  1443.             .Location = New Point(3, 3)
  1444.             .Font = New Font("Segoe UI", 11, FontStyle.Regular)
  1445.             .Size = New Size(Width - 3, Height - 3)
  1446.             .UseSystemPasswordChar = UseSystemPasswordChar
  1447.         End With
  1448.     End Sub
  1449.  
  1450.     Sub New()
  1451.         MyBase.New()
  1452.         NewTextBox()
  1453.         Controls.Add(_tb)
  1454.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1455.         DoubleBuffered = True
  1456.         BackColor = Color.FromArgb(61, 61, 61)
  1457.         ForeColor = Color.FromArgb(245, 245, 245)
  1458.         Font = New Font("Segoe UI", 11, FontStyle.Regular)
  1459.         Size = New Size(200, 30)
  1460.     End Sub
  1461.  
  1462.     Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  1463.         Dim b As Bitmap = New Bitmap(Width, Height)
  1464.         Dim g As Graphics = Graphics.FromImage(b)
  1465.  
  1466.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1467.  
  1468.         MyBase.OnPaint(e)
  1469.         g.SmoothingMode = SmoothingMode.HighQuality
  1470.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  1471.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1472.  
  1473.         With _tb
  1474.             .TextAlign = TextAlign
  1475.             .UseSystemPasswordChar = UseSystemPasswordChar
  1476.         End With
  1477.  
  1478.         g.FillPath(New SolidBrush(Color.FromArgb(61, 61, 61)), RoundRect(rect, 1))
  1479.         g.DrawPath(New Pen(Brushes.Black, 2), RoundRect(rect, 1))
  1480.  
  1481.         e.Graphics.DrawImage(b, New Point(0, 0))
  1482.         g.Dispose() : b.Dispose()
  1483.     End Sub
  1484.  
  1485.     Protected Overrides Sub OnResize(e As EventArgs)
  1486.         MyBase.OnResize(e)
  1487.         If Not MultiLine Then
  1488.             Dim tbheight As Integer = _tb.Height
  1489.             _tb.Location = New Point(10, CType(((Height / 2) - (tbheight / 2) - 1), Integer))
  1490.             _tb.Size = New Size(Width - 20, tbheight)
  1491.         Else
  1492.             _tb.Location = New Point(10, 10)
  1493.             _tb.Size = New Size(Width - 20, Height - 20)
  1494.         End If
  1495.     End Sub
  1496. End Class
  1497.  
  1498. Public Class FaderComboBox : Inherits ComboBox
  1499.     Private _startIndex As Integer = 0
  1500.     Private Property StartIndex As Integer
  1501.         Get
  1502.             Return _startIndex
  1503.         End Get
  1504.         Set(ByVal value As Integer)
  1505.             _startIndex = value
  1506.             Try
  1507.                 SelectedIndex = value
  1508.             Catch
  1509.             End Try
  1510.             Invalidate()
  1511.         End Set
  1512.     End Property
  1513.  
  1514.     Sub ReplaceItem(ByVal sender As System.Object, ByVal e As Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  1515.         e.DrawBackground()
  1516.         Dim sitemrect As New LinearGradientBrush(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  1517.         Dim itemrect As New LinearGradientBrush(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), Color.FromArgb(81, 81, 81), Color.FromArgb(61, 61, 61), 90S)
  1518.  
  1519.         Try
  1520.             If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  1521.                 e.Graphics.FillPath(sitemrect, RoundRect(New Rectangle(e.Bounds.X + 3, e.Bounds.Y, e.Bounds.Width - 7, e.Bounds.Height), 2))
  1522.                 e.Graphics.DrawPath(New Pen(Brushes.Black), RoundRect(New Rectangle(e.Bounds.X + 3, e.Bounds.Y, e.Bounds.Width - 7, e.Bounds.Height), 2))
  1523.             Else
  1524.                 e.Graphics.FillPath(itemrect, RoundRect(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), 2))
  1525.                 e.Graphics.DrawPath(New Pen(Brushes.Black), RoundRect(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), 2))
  1526.             End If
  1527.             e.Graphics.DrawString(GetItemText(Items(e.Index)), e.Font, New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1528.         Catch : End Try
  1529.     End Sub
  1530.  
  1531.     Sub New()
  1532.         MyBase.New()
  1533.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1534.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  1535.         BackColor = Color.Transparent
  1536.         DropDownStyle = ComboBoxStyle.DropDownList
  1537.         StartIndex = 0
  1538.         ItemHeight = 25
  1539.         DoubleBuffered = True
  1540.         Width = 200
  1541.     End Sub
  1542.  
  1543.     Protected Overrides Sub OnResize(e As EventArgs)
  1544.         MyBase.OnResize(e)
  1545.         Height = 20
  1546.     End Sub
  1547.  
  1548.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1549.         Dim b As Bitmap = New Bitmap(Width, Height)
  1550.         Dim g As Graphics = Graphics.FromImage(b)
  1551.  
  1552.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1553.  
  1554.         MyBase.OnPaint(e)
  1555.         g.Clear(BackColor)
  1556.  
  1557.         Dim rectgb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  1558.         g.FillPath(rectgb, RoundRect(rect, 3))
  1559.         g.DrawPath(New Pen(Brushes.Black, 2), RoundRect(rect, 3))
  1560.         g.SetClip(RoundRect(rect, 3))
  1561.         g.FillPath(rectgb, RoundRect(rect, 3))
  1562.         g.DrawPath(New Pen(Brushes.Black, 2), RoundRect(rect, 3))
  1563.         g.ResetClip()
  1564.  
  1565.         g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), Width - 9, 10, Width - 22, 10)
  1566.         g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), Width - 9, 11, Width - 22, 11)
  1567.         g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), Width - 9, 15, Width - 22, 15)
  1568.         g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), Width - 9, 16, Width - 22, 16)
  1569.         g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), Width - 9, 20, Width - 22, 20)
  1570.         g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), Width - 9, 21, Width - 22, 21)
  1571.         g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), New Point(Width - 29, 7), New Point(Width - 29, Height - 7))
  1572.         g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), New Point(Width - 30, 7), New Point(Width - 30, Height - 7))
  1573.  
  1574.         Try
  1575.             g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), rect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1576.         Catch : End Try
  1577.  
  1578.         e.Graphics.DrawImage(b, New Point(0, 0))
  1579.         g.Dispose() : b.Dispose()
  1580.     End Sub
  1581. End Class
  1582.  
  1583. Public Class FaderListBox : Inherits ListBox
  1584.     Sub New()
  1585.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  1586.                  ControlStyles.SupportsTransparentBackColor, True)
  1587.         BackColor = Color.Transparent
  1588.         DoubleBuffered = True
  1589.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  1590.         ForeColor = Color.White
  1591.         BackColor = Color.FromArgb(61, 61, 61)
  1592.         BorderStyle = Windows.Forms.BorderStyle.None
  1593.         ItemHeight = 20
  1594.     End Sub
  1595.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1596.         Dim b As Bitmap = New Bitmap(Width, Height)
  1597.         Dim g As Graphics = Graphics.FromImage(b)
  1598.  
  1599.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1600.  
  1601.         MyBase.OnPaint(e)
  1602.         g.Clear(Color.Transparent)
  1603.         g.FillPath(New SolidBrush(Color.FromArgb(61, 61, 61)), RoundRect(rect, 3))
  1604.         g.DrawPath(New Pen(Color.Black, 2), RoundRect(rect, 3))
  1605.  
  1606.         e.Graphics.DrawImage(b, New Point(0, 0))
  1607.         g.Dispose() : b.Dispose()
  1608.     End Sub
  1609.     Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
  1610.         Dim b As Bitmap = New Bitmap(Width, Height)
  1611.         Dim g As Graphics = Graphics.FromImage(b)
  1612.  
  1613.         g.TextRenderingHint = TextRenderingHint.AntiAlias
  1614.         g.SmoothingMode = SmoothingMode.HighQuality
  1615.  
  1616.         g.SetClip(RoundRect(New Rectangle(0, 0, Width, Height), 3))
  1617.         g.Clear(Color.Transparent)
  1618.         g.FillRectangle(New SolidBrush(BackColor), New Rectangle(e.Bounds.X, e.Bounds.Y - 1, e.Bounds.Width, e.Bounds.Height + 3))
  1619.  
  1620.         If e.State.ToString().Contains("Selected,") Then
  1621.             Dim selectgb As New LinearGradientBrush(New Rectangle(e.Bounds.X, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height), Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 31), 90S)
  1622.             g.FillRectangle(selectgb, New Rectangle(e.Bounds.X, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height))
  1623.             g.DrawRectangle(New Pen(Color.FromArgb(128, 128, 128)), New Rectangle(e.Bounds.X, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height))
  1624.             Try
  1625.                 g.DrawString(Items(e.Index).ToString(), New Font("Segoe UI", 10, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(e.Bounds.X + 3, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1626.             Catch : End Try
  1627.         Else
  1628.             Dim nonselectgb As New LinearGradientBrush(New Rectangle(e.Bounds.X, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height), Color.FromArgb(81, 81, 81), Color.FromArgb(61, 61, 61), 90S)
  1629.             g.FillRectangle(nonselectgb, e.Bounds)
  1630.             Try
  1631.                 g.DrawString(Items(e.Index).ToString(), New Font("Segoe UI", 10, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(e.Bounds.X + 3, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1632.             Catch : End Try
  1633.         End If
  1634.  
  1635.         g.DrawPath(New Pen(Color.FromArgb(61, 61, 61), 2), RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 1))
  1636.  
  1637.         e.Graphics.DrawImage(b, New Point(0, 0))
  1638.         g.Dispose() : b.Dispose()
  1639.     End Sub
  1640. End Class
  1641.  
  1642. Public Class FaderAlertBox : Inherits Control
  1643.     Dim WithEvents _mytimer As Windows.Forms.Timer
  1644.  
  1645.     Enum AlertStyle
  1646.         [Info]
  1647.         [Success]
  1648.         [Error]
  1649.     End Enum
  1650.  
  1651.     Private _style As AlertStyle
  1652.     Public Property Style As AlertStyle
  1653.         Get
  1654.             Return _style
  1655.         End Get
  1656.         Set(value As AlertStyle)
  1657.             _style = value
  1658.         End Set
  1659.     End Property
  1660.  
  1661.     Private _text As String
  1662.     Overrides Property Text As String
  1663.         Get
  1664.             Return MyBase.Text
  1665.         End Get
  1666.         Set(ByVal value As String)
  1667.             MyBase.Text = value
  1668.             If _text IsNot Nothing Then
  1669.                 _text = value
  1670.             End If
  1671.         End Set
  1672.     End Property
  1673.  
  1674.     Shadows Property Visible As Boolean
  1675.         Get
  1676.             Return MyBase.Visible = False
  1677.         End Get
  1678.         Set(value As Boolean)
  1679.             MyBase.Visible = value
  1680.         End Set
  1681.     End Property
  1682.  
  1683.     Protected Overrides Sub OnTextChanged(e As EventArgs)
  1684.         MyBase.OnTextChanged(e) : Invalidate()
  1685.     End Sub
  1686.  
  1687.     Public Sub ShowAlertBox(mystyle As AlertStyle, str As String, interval As Integer)
  1688.         _style = mystyle
  1689.         Text = str
  1690.         Visible = True
  1691.         _mytimer.Interval = interval
  1692.         _mytimer.Enabled = True
  1693.     End Sub
  1694.  
  1695.     Sub New()
  1696.         MyBase.New()
  1697.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  1698.         BackColor = Color.Transparent
  1699.         Size = New Size(500, 30)
  1700.         DoubleBuffered = True
  1701.         _mytimer = New Timer()
  1702.     End Sub
  1703.  
  1704.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1705.         Dim b As Bitmap = New Bitmap(Width, Height)
  1706.         Dim g As Graphics = Graphics.FromImage(b)
  1707.  
  1708.         Dim rect As New Rectangle(0, 0, Width - 1, Height - 1)
  1709.         Dim textrect As New Rectangle(20, 5, Width - 21, Height - 11)
  1710.         Dim logorect As New Rectangle(7, 7, 20, 20)
  1711.         Dim logocirclerect As New Rectangle(5, 5, 20, 20)
  1712.  
  1713.         g.TextRenderingHint = TextRenderingHint.AntiAlias
  1714.         g.SmoothingMode = SmoothingMode.HighQuality
  1715.         g.Clear(Color.Transparent)
  1716.  
  1717.         MyBase.OnPaint(e)
  1718.         Select Case _style
  1719.             Case AlertStyle.Success
  1720.                 g.FillRectangle(New SolidBrush(Color.FromArgb(30, 0, 255, 0)), rect)
  1721.                 g.DrawRectangle(New Pen(Color.FromArgb(0, 0, 0)), rect)
  1722.                 g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), textrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1723.                 g.DrawString("ü", New Font("Wingdings", 14), New SolidBrush(Color.FromArgb(245, 245, 245)), logorect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1724.             Case AlertStyle.Error
  1725.                 g.FillRectangle(New SolidBrush(Color.FromArgb(30, 255, 0, 0)), rect)
  1726.                 g.DrawRectangle(New Pen(Color.FromArgb(0, 0, 0)), rect)
  1727.                 g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), textrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1728.                 g.DrawString("r", New Font("Marlett", 10), New SolidBrush(Color.FromArgb(245, 245, 245)), logorect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1729.             Case AlertStyle.Info
  1730.                 g.FillRectangle(New SolidBrush(Color.FromArgb(30, 0, 0, 255)), rect)
  1731.                 g.DrawRectangle(New Pen(Color.FromArgb(0, 0, 0)), rect)
  1732.                 g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), textrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1733.                 g.DrawString("i", New Font("Segoe UI", 12), New SolidBrush(Color.FromArgb(245, 245, 245)), logorect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1734.         End Select
  1735.  
  1736.         g.DrawEllipse(New Pen(Color.FromArgb(255, 255, 255)), logocirclerect)
  1737.  
  1738.         e.Graphics.DrawImage(b, New Point(0, 0))
  1739.         g.Dispose() : b.Dispose()
  1740.     End Sub
  1741.  
  1742.     Private Sub MyTimer_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles _mytimer.Tick
  1743.         Visible = False
  1744.         _mytimer.Enabled = False
  1745.     End Sub
  1746. End Class
  1747.  
  1748. Public Class FaderNotifyButton : Inherits Control
  1749.     Dim _state As MouseState
  1750.  
  1751.     Private _showNotification As Boolean = True
  1752.     Public Property ShowNotification As Boolean
  1753.         Get
  1754.             Return _showNotification
  1755.         End Get
  1756.         Set(value As Boolean)
  1757.             _showNotification = value
  1758.             Invalidate()
  1759.         End Set
  1760.     End Property
  1761.  
  1762.     Private _notifyValue As UInteger = 0
  1763.     Public Property NotifyValue As UInteger
  1764.         Get
  1765.             Return _notifyValue
  1766.         End Get
  1767.         Set(value As UInteger)
  1768.             _notifyValue = value
  1769.             Invalidate()
  1770.         End Set
  1771.     End Property
  1772.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1773.         MyBase.OnMouseDown(e)
  1774.         _state = MouseState.Down
  1775.         Invalidate()
  1776.     End Sub
  1777.  
  1778.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1779.         MyBase.OnMouseUp(e)
  1780.         _state = MouseState.Over
  1781.         Invalidate()
  1782.     End Sub
  1783.  
  1784.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  1785.         MyBase.OnMouseEnter(e)
  1786.         _state = MouseState.Over
  1787.         Invalidate()
  1788.     End Sub
  1789.  
  1790.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1791.         MyBase.OnMouseLeave(e)
  1792.         _state = MouseState.None
  1793.         Invalidate()
  1794.     End Sub
  1795.  
  1796.     Sub New()
  1797.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1798.         BackColor = Color.Transparent
  1799.         DoubleBuffered = True
  1800.         Size = New Size(160, 40)
  1801.         _state = MouseState.None
  1802.     End Sub
  1803.  
  1804.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1805.         Dim b As Bitmap = New Bitmap(Width, Height)
  1806.         Dim g As Graphics = Graphics.FromImage(b)
  1807.  
  1808.         Dim rect As Rectangle = New Rectangle(0, 10, Width - 1, Height - 11)
  1809.         Dim btnfont As New Font("Segoe UI", 11, FontStyle.Bold)
  1810.  
  1811.         MyBase.OnPaint(e)
  1812.         g.SmoothingMode = SmoothingMode.HighQuality
  1813.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  1814.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1815.         g.Clear(BackColor)
  1816.  
  1817.         Dim rectgb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), LinearGradientMode.Vertical)
  1818.         g.FillRectangle(rectgb, rect)
  1819.         g.DrawRectangle(New Pen(Brushes.Black), rect)
  1820.  
  1821.         Select Case _state
  1822.             Case MouseState.None
  1823.                 Dim rectnonegb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), LinearGradientMode.Vertical)
  1824.                 g.FillRectangle(rectnonegb, rect)
  1825.                 g.DrawRectangle(New Pen(Brushes.Black), rect)
  1826.                 g.DrawString(Text, btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), rect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1827.             Case MouseState.Down
  1828.                 g.TranslateTransform(1, 1)
  1829.                 g.DrawString(Text, btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), rect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1830.             Case MouseState.Over
  1831.                 Dim rectovergb As New LinearGradientBrush(rect, Color.FromArgb(41, 41, 41), Color.FromArgb(61, 61, 61), LinearGradientMode.Vertical)
  1832.                 g.FillRectangle(rectovergb, rect)
  1833.                 g.DrawRectangle(New Pen(Brushes.Black), rect)
  1834.                 g.DrawString(Text, btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), rect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1835.         End Select
  1836.  
  1837.         If ShowNotification Then
  1838.             Select Case NotifyValue
  1839.                 Case 0 To 9
  1840.                     g.FillEllipse(New SolidBrush(Color.FromArgb(81, 81, 81)), New Rectangle(Width - 25, 0, 20, 20))
  1841.                     g.DrawEllipse(New Pen(Brushes.Black), New Rectangle(Width - 25, 0, 20, 20))
  1842.                     g.DrawString(NotifyValue.ToString(), btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(Width - 25, 0, 20, 20), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1843.                 Case 10 To 99
  1844.                     g.FillEllipse(New SolidBrush(Color.FromArgb(81, 81, 81)), New Rectangle(Width - 45, 0, 40, 20))
  1845.                     g.DrawEllipse(New Pen(Brushes.Black), New Rectangle(Width - 45, 0, 40, 20))
  1846.                     g.DrawString(NotifyValue.ToString(), btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(Width - 45, 0, 40, 20), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1847.                 Case 100 To 999
  1848.                     g.FillEllipse(New SolidBrush(Color.FromArgb(81, 81, 81)), New Rectangle(Width - 65, 0, 60, 20))
  1849.                     g.DrawEllipse(New Pen(Brushes.Black), New Rectangle(Width - 65, 0, 60, 20))
  1850.                     g.DrawString(NotifyValue.ToString(), btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(Width - 65, 0, 60, 20), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1851.             End Select
  1852.         End If
  1853.  
  1854.         e.Graphics.DrawImage(b, New Point(0, 0))
  1855.         g.Dispose() : b.Dispose()
  1856.     End Sub
  1857. End Class
Advertisement
Add Comment
Please, Sign In to add comment