SaketSaket

Fader Theme HF

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