Guest User

Untitled

a guest
May 21st, 2014
1,627
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Drawing.Drawing2D
  2. Imports System.ComponentModel
  3.  
  4. 'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
  5.  
  6. '--------------------- [ Theme ] --------------------
  7. 'Creator: Mephobia
  8. 'Contact: Mephobia.HF (Skype)
  9. 'Created: 10.27.2012
  10. 'Changed: 10.27.2012
  11. '-------------------- [ /Theme ] ---------------------
  12.  
  13. 'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
  14.  
  15. Enum MouseState As Byte
  16.     None = 0
  17.     Over = 1
  18.     Down = 2
  19.     Block = 3
  20. End Enum
  21. Module Draw
  22.     Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  23.         Dim P As GraphicsPath = New GraphicsPath()
  24.         Dim ArcRectangleWidth As Integer = Curve * 2
  25.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  26.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  27.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  28.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  29.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  30.         Return P
  31.     End Function
  32.     Public Function RoundRect(ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal Curve As Integer) As GraphicsPath
  33.         Dim Rectangle As Rectangle = New Rectangle(X, Y, Width, Height)
  34.         Dim P As GraphicsPath = New GraphicsPath()
  35.         Dim ArcRectangleWidth As Integer = Curve * 2
  36.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  37.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  38.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  39.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  40.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  41.         Return P
  42.     End Function
  43. End Module
  44. Public Class PerplexButton : Inherits Control
  45. #Region " MouseStates "
  46.     Dim State As MouseState = MouseState.None
  47.     Protected Overrides Sub OnMouseDown(e As System.Windows.Forms.MouseEventArgs)
  48.         MyBase.OnMouseDown(e)
  49.         State = MouseState.Down : Invalidate()
  50.     End Sub
  51.     Protected Overrides Sub OnMouseUp(e As System.Windows.Forms.MouseEventArgs)
  52.         MyBase.OnMouseUp(e)
  53.         State = MouseState.Over : Invalidate()
  54.     End Sub
  55.     Protected Overrides Sub OnMouseEnter(e As System.EventArgs)
  56.         MyBase.OnMouseEnter(e)
  57.         State = MouseState.Over : Invalidate()
  58.     End Sub
  59.     Protected Overrides Sub OnMouseLeave(e As System.EventArgs)
  60.         MyBase.OnMouseLeave(e)
  61.         State = MouseState.None : Invalidate()
  62.     End Sub
  63. #End Region
  64.  
  65.     Sub New()
  66.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  67.         BackColor = Color.Transparent
  68.         ForeColor = Color.FromArgb(205, 205, 205)
  69.         DoubleBuffered = True
  70.     End Sub
  71.  
  72.     Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs)
  73.         Dim B As New Bitmap(Width, Height)
  74.         Dim G As Graphics = Graphics.FromImage(B)
  75.         Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
  76.  
  77.  
  78.         MyBase.OnPaint(e)
  79.  
  80.         G.Clear(BackColor)
  81.         Dim drawFont As New Font("Tahoma", 8, FontStyle.Bold)
  82.  
  83.         'G.CompositingQuality = CompositingQuality.HighQuality
  84.        G.SmoothingMode = SmoothingMode.HighQuality
  85.  
  86.         Select Case State
  87.             Case MouseState.None
  88.                 Dim lgb As New LinearGradientBrush(ClientRectangle, Color.FromArgb(66, 67, 70), Color.FromArgb(43, 44, 48), 90S)
  89.                 G.FillPath(lgb, Draw.RoundRect(ClientRectangle, 2))
  90.                 Dim gloss As New LinearGradientBrush(New Rectangle(0, 0, Width - 125, 35 / 2), Color.FromArgb(75, Color.FromArgb(26, 26, 26)), Color.FromArgb(3, 255, 255, 255), 90S)
  91.                 G.FillPath(gloss, Draw.RoundRect(ClientRectangle, 2))
  92.  
  93.                 Dim botbar As New LinearGradientBrush(New Rectangle(5, Height - 10, Width - 11, 5), Color.FromArgb(44, 45, 49), Color.FromArgb(45, 46, 50), 90S)
  94.                 G.FillPath(botbar, Draw.RoundRect(New Rectangle(5, Height - 10, Width - 11, 5), 1))
  95.  
  96.                 Dim fill As New LinearGradientBrush(New Rectangle(6, Height - 9, Width - 13, 3), Color.FromArgb(174, 195, 30), Color.FromArgb(141, 153, 16), 90S)
  97.                 G.FillPath(fill, Draw.RoundRect(New Rectangle(6, Height - 9, Width - 13, 3), 1))
  98.                 Dim o As New Pen(Color.FromArgb(50, 50, 50), 1)
  99.                 G.DrawPath(o, Draw.RoundRect(ClientRectangle, 2))
  100.                 G.DrawPath(Pens.Black, Draw.RoundRect(New Rectangle(1, 1, Width - 3, Height - 3), 2))
  101.             Case MouseState.Over
  102.                 Dim lgb As New LinearGradientBrush(ClientRectangle, Color.FromArgb(66, 67, 70), Color.FromArgb(43, 44, 48), 90S)
  103.                 G.FillPath(lgb, Draw.RoundRect(ClientRectangle, 2))
  104.                 Dim gloss As New LinearGradientBrush(New Rectangle(0, 0, Width - 125, 35 / 2), Color.FromArgb(15, Color.FromArgb(26, 26, 26)), Color.FromArgb(1, 255, 255, 255), 90S)
  105.                 G.FillPath(gloss, Draw.RoundRect(ClientRectangle, 2))
  106.  
  107.                 Dim botbar As New LinearGradientBrush(New Rectangle(5, Height - 10, Width - 11, 5), Color.FromArgb(44, 45, 49), Color.FromArgb(45, 46, 50), 90S)
  108.                 G.FillPath(botbar, Draw.RoundRect(New Rectangle(5, Height - 10, Width - 11, 5), 1))
  109.  
  110.                 Dim fill As New LinearGradientBrush(New Rectangle(6, Height - 9, Width - 13, 3), Color.FromArgb(174, 195, 30), Color.FromArgb(141, 153, 16), 90S)
  111.                 G.FillPath(fill, Draw.RoundRect(New Rectangle(6, Height - 9, Width - 13, 3), 1))
  112.                 Dim o As New Pen(Color.FromArgb(50, 50, 50), 1)
  113.                 G.DrawPath(o, Draw.RoundRect(ClientRectangle, 2))
  114.                 G.DrawPath(Pens.Black, Draw.RoundRect(New Rectangle(1, 1, Width - 3, Height - 3), 2))
  115.             Case MouseState.Down
  116.                 Dim lgb As New LinearGradientBrush(ClientRectangle, Color.FromArgb(66, 67, 70), Color.FromArgb(43, 44, 48), 90S)
  117.                 G.FillPath(lgb, Draw.RoundRect(ClientRectangle, 2))
  118.                 Dim gloss As New LinearGradientBrush(New Rectangle(0, 0, Width - 125, 35 / 2), Color.FromArgb(100, Color.FromArgb(26, 26, 26)), Color.FromArgb(1, 255, 255, 255), 90S)
  119.                 G.FillPath(gloss, Draw.RoundRect(ClientRectangle, 2))
  120.  
  121.                 Dim botbar As New LinearGradientBrush(New Rectangle(5, Height - 10, Width - 11, 5), Color.FromArgb(44, 45, 49), Color.FromArgb(45, 46, 50), 90S)
  122.                 G.FillPath(botbar, Draw.RoundRect(New Rectangle(5, Height - 10, Width - 11, 5), 1))
  123.  
  124.                 Dim fill As New LinearGradientBrush(New Rectangle(6, Height - 9, Width - 13, 3), Color.FromArgb(174, 195, 30), Color.FromArgb(141, 153, 16), 90S)
  125.                 G.FillPath(fill, Draw.RoundRect(New Rectangle(6, Height - 9, Width - 13, 3), 1))
  126.                 Dim o As New Pen(Color.FromArgb(50, 50, 50), 1)
  127.                 G.DrawPath(o, Draw.RoundRect(ClientRectangle, 2))
  128.                 G.DrawPath(Pens.Black, Draw.RoundRect(New Rectangle(1, 1, Width - 3, Height - 3), 2))
  129.         End Select
  130.  
  131.         G.DrawString(Text, drawFont, New SolidBrush(Color.FromArgb(5, 5, 5)), New Rectangle(1, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  132.         G.DrawString(Text, drawFont, New SolidBrush(Color.FromArgb(205, 205, 205)), New Rectangle(0, -1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  133.  
  134.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  135.         G.Dispose() : B.Dispose()
  136.     End Sub
  137. End Class
  138. Public Class PerplexTheme : Inherits ContainerControl
  139.     Sub New()
  140.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  141.         BackColor = Color.FromArgb(25, 25, 25)
  142.         DoubleBuffered = True
  143.     End Sub
  144.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  145.         Dim B As New Bitmap(Width, Height)
  146.         Dim G As Graphics = Graphics.FromImage(B)
  147.         Dim TopLeft As New Rectangle(0, 0, Width - 125, 28)
  148.         Dim TopRight As New Rectangle(Width - 82, 0, 81, 28)
  149.         Dim Body As New Rectangle(10, 10, Width - 21, Height - 16)
  150.         Dim Body2 As New Rectangle(5, 5, Width - 11, Height - 6)
  151.  
  152.         MyBase.OnPaint(e)
  153.  
  154.         G.Clear(Color.Fuchsia)
  155.  
  156.         Dim BodyBrush As New LinearGradientBrush(Body2, Color.FromArgb(26, 26, 26), Color.FromArgb(30, 35, 48), 90S)
  157.         G.FillPath(BodyBrush, Draw.RoundRect(Body2, 3))
  158.         G.DrawPath(New Pen(Brushes.Black), Draw.RoundRect(Body2, 3))
  159.  
  160.         Dim BodyBrush2 As New LinearGradientBrush(Body, Color.FromArgb(46, 46, 46), Color.FromArgb(50, 55, 58), 120S)
  161.         G.FillPath(BodyBrush2, Draw.RoundRect(Body, 3))
  162.         G.DrawPath(New Pen(Brushes.Black), Draw.RoundRect(Body, 3))
  163.  
  164.         Dim gloss As New LinearGradientBrush(New Rectangle(0, 0, Width - 125, 28 / 2), Color.FromArgb(240, Color.FromArgb(26, 26, 26)), Color.FromArgb(5, 255, 255, 255), 90S)
  165.         Dim mainbrush As New LinearGradientBrush(TopLeft, Color.FromArgb(26, 26, 26), Color.FromArgb(30, 30, 30), 90S)
  166.         G.FillPath(mainbrush, Draw.RoundRect(TopLeft, 3))
  167.         G.FillPath(gloss, Draw.RoundRect(TopLeft, 3))
  168.         G.DrawPath(New Pen(Brushes.Black), Draw.RoundRect(TopLeft, 3))
  169.  
  170.         Dim gloss2 As New LinearGradientBrush(New Rectangle(Width - 82, 0, Width - 205, 28 / 2), Color.FromArgb(240, Color.FromArgb(26, 26, 26)), Color.FromArgb(5, 255, 255, 255), 90S)
  171.         Dim mainbrush2 As New LinearGradientBrush(TopRight, Color.FromArgb(26, 26, 26), Color.FromArgb(30, 30, 30), 90S)
  172.         G.FillPath(mainbrush, Draw.RoundRect(TopRight, 3))
  173.         G.FillPath(gloss2, Draw.RoundRect(TopRight, 3))
  174.         G.DrawPath(New Pen(Brushes.Black), Draw.RoundRect(TopRight, 3))
  175.  
  176.         Dim p1 As New Pen(Color.FromArgb(174, 195, 30), 2)
  177.         G.DrawLine(p1, 14, 9, 14, 22)
  178.         Dim p2 As New Pen(Color.FromArgb(174, 195, 30), 2)
  179.         G.DrawLine(p2, 17, 6, 17, 25)
  180.         Dim p3 As New Pen(Color.FromArgb(174, 195, 30), 2)
  181.         G.DrawLine(p3, 20, 9, 20, 22)
  182.  
  183.         Dim p4 As New Pen(Color.FromArgb(174, 195, 30), 2)
  184.         G.DrawLine(p4, 11, 12, 11, 19)
  185.         Dim p5 As New Pen(Color.FromArgb(174, 195, 30), 2)
  186.         G.DrawLine(p4, 23, 12, 23, 19)
  187.  
  188.         Dim p6 As New Pen(Color.FromArgb(174, 195, 30), 2)
  189.         G.DrawLine(p6, 8, 14, 8, 17)
  190.         Dim p7 As New Pen(Color.FromArgb(174, 195, 30), 2)
  191.         G.DrawLine(p7, 26, 14, 26, 17)
  192.  
  193.  
  194.         Dim drawFont As New Font("Tahoma", 10, FontStyle.Bold)
  195.         G.DrawString(Text, drawFont, New SolidBrush(Color.WhiteSmoke), New Rectangle(32, 1, Width - 1, 27), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  196.  
  197.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  198.         G.Dispose() : B.Dispose()
  199.     End Sub
  200.  
  201.     Private MouseP As Point = New Point(0, 0)
  202.     Private Cap As Boolean = False
  203.     Private MoveHeight% = 29 : Private pos% = 0
  204.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  205.         MyBase.OnMouseDown(e)
  206.         If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
  207.             Cap = True : MouseP = e.Location
  208.         End If
  209.     End Sub
  210.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  211.         MyBase.OnMouseUp(e) : Cap = False
  212.     End Sub
  213.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  214.         MyBase.OnMouseMove(e)
  215.         If Cap Then
  216.             Parent.Location = MousePosition - MouseP
  217.         End If
  218.     End Sub
  219.  
  220.     Protected Overrides Sub OnCreateControl()
  221.         MyBase.OnCreateControl()
  222.         Me.ParentForm.FormBorderStyle = FormBorderStyle.None
  223.         Me.ParentForm.TransparencyKey = Color.Fuchsia
  224.         Dock = DockStyle.Fill
  225.     End Sub
  226. End Class
  227. Public Class PerplexControlBox : Inherits Control
  228.  
  229. #Region " MouseStates "
  230.     Dim State As MouseState = MouseState.None
  231.     Dim MinBtn As New Rectangle(0, 0, 20, 20)
  232.     Dim MaxBtn As New Rectangle(25, 0, 20, 20)
  233.     Dim X As Integer
  234.  
  235.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  236.         MyBase.OnMouseDown(e)
  237.         If e.Location.X > 0 AndAlso e.Location.X < 20 Then
  238.             FindForm.WindowState = FormWindowState.Minimized
  239.         ElseIf e.Location.X > 25 AndAlso e.Location.X < 45 Then
  240.             FindForm.Close()
  241.         End If
  242.         State = MouseState.Down : Invalidate()
  243.     End Sub
  244.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  245.         MyBase.OnMouseUp(e)
  246.         State = MouseState.Over : Invalidate()
  247.     End Sub
  248.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  249.         MyBase.OnMouseEnter(e)
  250.         State = MouseState.Over : Invalidate()
  251.     End Sub
  252.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  253.         MyBase.OnMouseLeave(e)
  254.         State = MouseState.None : Invalidate()
  255.     End Sub
  256.     Protected Overrides Sub OnMouseMove(e As System.Windows.Forms.MouseEventArgs)
  257.         MyBase.OnMouseMove(e)
  258.         X = e.Location.X
  259.         Invalidate()
  260.     End Sub
  261. #End Region
  262.  
  263.     Sub New()
  264.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  265.         BackColor = Color.Transparent
  266.         ForeColor = Color.FromArgb(205, 205, 205)
  267.         DoubleBuffered = True
  268.     End Sub
  269.  
  270.     Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs)
  271.         Dim B As New Bitmap(Width, Height)
  272.         Dim G As Graphics = Graphics.FromImage(B)
  273.  
  274.         MyBase.OnPaint(e)
  275.  
  276.         G.Clear(BackColor)
  277.  
  278.         'G.CompositingQuality = CompositingQuality.HighQuality
  279.        G.SmoothingMode = SmoothingMode.HighQuality
  280.  
  281.         Select Case State
  282.             Case MouseState.None
  283.                 Dim mlgb As New LinearGradientBrush(MinBtn, Color.FromArgb(66, 67, 70), Color.FromArgb(43, 44, 48), 90S)
  284.                 G.FillPath(mlgb, Draw.RoundRect(MinBtn, 4))
  285.                 G.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 1), Draw.RoundRect(MinBtn, 4))
  286.                 Dim mf As New Font("Marlett", 9)
  287.                 Dim mfb As New SolidBrush(Color.FromArgb(174, 195, 30))
  288.                 G.DrawString("0", mf, mfb, 4, 4)
  289.  
  290.                 Dim lgb As New LinearGradientBrush(MaxBtn, Color.FromArgb(66, 67, 70), Color.FromArgb(43, 44, 48), 90S)
  291.                 G.FillPath(lgb, Draw.RoundRect(MaxBtn, 4))
  292.                 G.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 1), Draw.RoundRect(MaxBtn, 4))
  293.                 Dim f As New Font("Marlett", 9)
  294.                 Dim fb As New SolidBrush(Color.FromArgb(174, 195, 30))
  295.                 G.DrawString("r", f, fb, 28, 4)
  296.             Case MouseState.Over
  297.                 If X > 0 AndAlso X < 20 Then
  298.                     Dim mlgb As New LinearGradientBrush(MinBtn, Color.FromArgb(100, 66, 67, 70), Color.FromArgb(100, 43, 44, 48), 90S)
  299.                     G.FillPath(mlgb, Draw.RoundRect(MinBtn, 4))
  300.                     G.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 1), Draw.RoundRect(MinBtn, 4))
  301.                     Dim mf As New Font("Marlett", 9)
  302.                     Dim mfb As New SolidBrush(Color.FromArgb(174, 195, 30))
  303.                     G.DrawString("0", mf, mfb, 4, 4)
  304.  
  305.                     Dim lgb As New LinearGradientBrush(MaxBtn, Color.FromArgb(66, 67, 70), Color.FromArgb(43, 44, 48), 90S)
  306.                     G.FillPath(lgb, Draw.RoundRect(MaxBtn, 4))
  307.                     G.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 1), Draw.RoundRect(MaxBtn, 4))
  308.                     Dim f As New Font("Marlett", 9)
  309.                     Dim fb As New SolidBrush(Color.FromArgb(174, 195, 30))
  310.                     G.DrawString("r", f, fb, 28, 4)
  311.  
  312.                 ElseIf X > 25 AndAlso X < 45 Then
  313.                     Dim mlgb As New LinearGradientBrush(MinBtn, Color.FromArgb(66, 67, 70), Color.FromArgb(43, 44, 48), 90S)
  314.                     G.FillPath(mlgb, Draw.RoundRect(MinBtn, 4))
  315.                     G.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 1), Draw.RoundRect(MinBtn, 4))
  316.                     Dim mf As New Font("Marlett", 9)
  317.                     Dim mfb As New SolidBrush(Color.FromArgb(174, 195, 30))
  318.                     G.DrawString("0", mf, mfb, 4, 4)
  319.  
  320.                     Dim lgb As New LinearGradientBrush(MaxBtn, Color.FromArgb(100, 66, 67, 70), Color.FromArgb(100, 43, 44, 48), 90S)
  321.                     G.FillPath(lgb, Draw.RoundRect(MaxBtn, 4))
  322.                     G.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 1), Draw.RoundRect(MaxBtn, 4))
  323.                     Dim f As New Font("Marlett", 9)
  324.                     Dim fb As New SolidBrush(Color.FromArgb(174, 195, 30))
  325.                     G.DrawString("r", f, fb, 28, 4)
  326.                 Else
  327.                     Dim mlgb As New LinearGradientBrush(MinBtn, Color.FromArgb(66, 67, 70), Color.FromArgb(43, 44, 48), 90S)
  328.                     G.FillPath(mlgb, Draw.RoundRect(MinBtn, 4))
  329.                     G.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 1), Draw.RoundRect(MinBtn, 4))
  330.                     Dim mf As New Font("Marlett", 9)
  331.                     Dim mfb As New SolidBrush(Color.FromArgb(174, 195, 30))
  332.                     G.DrawString("0", mf, mfb, 4, 4)
  333.  
  334.                     Dim lgb As New LinearGradientBrush(MaxBtn, Color.FromArgb(66, 67, 70), Color.FromArgb(43, 44, 48), 90S)
  335.                     G.FillPath(lgb, Draw.RoundRect(MaxBtn, 4))
  336.                     G.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 1), Draw.RoundRect(MaxBtn, 4))
  337.                     Dim f As New Font("Marlett", 9)
  338.                     Dim fb As New SolidBrush(Color.FromArgb(174, 195, 30))
  339.                     G.DrawString("r", f, fb, 28, 4)
  340.                 End If
  341.             Case MouseState.Down
  342.                 Dim mlgb As New LinearGradientBrush(MinBtn, Color.FromArgb(66, 67, 70), Color.FromArgb(43, 44, 48), 90S)
  343.                 G.FillPath(mlgb, Draw.RoundRect(MinBtn, 4))
  344.                 G.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 1), Draw.RoundRect(MinBtn, 4))
  345.                 Dim mf As New Font("Marlett", 9)
  346.                 Dim mfb As New SolidBrush(Color.FromArgb(174, 195, 30))
  347.                 G.DrawString("0", mf, mfb, 4, 4)
  348.  
  349.                 Dim lgb As New LinearGradientBrush(MaxBtn, Color.FromArgb(66, 67, 70), Color.FromArgb(43, 44, 48), 90S)
  350.                 G.FillPath(lgb, Draw.RoundRect(MaxBtn, 4))
  351.                 G.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 1), Draw.RoundRect(MaxBtn, 4))
  352.                 Dim f As New Font("Marlett", 9)
  353.                 Dim fb As New SolidBrush(Color.FromArgb(174, 195, 30))
  354.                 G.DrawString("r", f, fb, 28, 4)
  355.             Case Else
  356.                 Dim mlgb As New LinearGradientBrush(MinBtn, Color.FromArgb(66, 67, 70), Color.FromArgb(43, 44, 48), 90S)
  357.                 G.FillPath(mlgb, Draw.RoundRect(MinBtn, 4))
  358.                 G.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 1), Draw.RoundRect(MinBtn, 4))
  359.                 Dim mf As New Font("Marlett", 9)
  360.                 Dim mfb As New SolidBrush(Color.FromArgb(174, 195, 30))
  361.                 G.DrawString("0", mf, mfb, 4, 4)
  362.  
  363.                 Dim lgb As New LinearGradientBrush(MaxBtn, Color.FromArgb(66, 67, 70), Color.FromArgb(43, 44, 48), 90S)
  364.                 G.FillPath(lgb, Draw.RoundRect(MaxBtn, 4))
  365.                 G.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 1), Draw.RoundRect(MaxBtn, 4))
  366.                 Dim f As New Font("Marlett", 9)
  367.                 Dim fb As New SolidBrush(Color.FromArgb(174, 195, 30))
  368.                 G.DrawString("r", f, fb, 28, 4)
  369.         End Select
  370.  
  371.  
  372.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  373.         G.Dispose() : B.Dispose()
  374.     End Sub
  375. End Class
  376. Public Class PerplexGroupBox : Inherits ContainerControl
  377.  
  378.     Sub New()
  379.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  380.         BackColor = Color.Transparent
  381.         DoubleBuffered = True
  382.     End Sub
  383.     Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs)
  384.         Dim B As New Bitmap(Width, Height)
  385.         Dim G As Graphics = Graphics.FromImage(B)
  386.         Dim Body As New Rectangle(4, 25, Width - 9, Height - 30)
  387.         Dim Body2 As New Rectangle(0, 0, Width - 1, Height - 1)
  388.  
  389.         MyBase.OnPaint(e)
  390.  
  391.         G.Clear(Color.Transparent)
  392.  
  393.         G.SmoothingMode = SmoothingMode.HighQuality
  394.         G.CompositingQuality = CompositingQuality.HighQuality
  395.  
  396.         Dim p As New Pen(Color.Black)
  397.         Dim BodyBrush As New LinearGradientBrush(Body2, Color.FromArgb(26, 26, 26), Color.FromArgb(30, 30, 30), 90S)
  398.         G.FillPath(BodyBrush, Draw.RoundRect(Body2, 3))
  399.         G.DrawPath(New Pen(Brushes.Black), Draw.RoundRect(Body2, 3))
  400.  
  401.         Dim BodyBrush2 As New LinearGradientBrush(Body, Color.FromArgb(46, 46, 46), Color.FromArgb(50, 55, 58), 120S)
  402.         G.FillPath(BodyBrush2, Draw.RoundRect(Body, 3))
  403.         G.DrawPath(p, Draw.RoundRect(Body, 3))
  404.  
  405.         Dim drawFont As New Font("Tahoma", 9, FontStyle.Bold)
  406.         G.DrawString(Text, drawFont, New SolidBrush(Color.WhiteSmoke), 67, 14, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  407.  
  408.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  409.         G.Dispose() : B.Dispose()
  410.     End Sub
  411. End Class
  412. Public Class PerplexProgressBar : Inherits Control
  413.  
  414. #Region " Control Help - Properties & Flicker Control "
  415.     Private OFS As Integer = 0
  416.     Private Speed As Integer = 50
  417.     Private _Maximum As Integer = 100
  418.  
  419.     Public Property Maximum() As Integer
  420.         Get
  421.             Return _Maximum
  422.         End Get
  423.         Set(ByVal v As Integer)
  424.             Select Case v
  425.                 Case Is < _Value
  426.                     _Value = v
  427.             End Select
  428.             _Maximum = v
  429.             Invalidate()
  430.         End Set
  431.     End Property
  432.     Private _Value As Integer = 0
  433.     Public Property Value() As Integer
  434.         Get
  435.             Select Case _Value
  436.                 Case 0
  437.                     Return 0
  438.                 Case Else
  439.                     Return _Value
  440.             End Select
  441.         End Get
  442.         Set(ByVal v As Integer)
  443.             Select Case v
  444.                 Case Is > _Maximum
  445.                     v = _Maximum
  446.             End Select
  447.             _Value = v
  448.             Invalidate()
  449.         End Set
  450.     End Property
  451.     Private _ShowPercentage As Boolean = False
  452.     Public Property ShowPercentage() As Boolean
  453.         Get
  454.             Return _ShowPercentage
  455.         End Get
  456.         Set(ByVal v As Boolean)
  457.             _ShowPercentage = v
  458.             Invalidate()
  459.         End Set
  460.     End Property
  461.  
  462.     Protected Overrides Sub CreateHandle()
  463.         MyBase.CreateHandle()
  464.         ' Dim tmr As New Timer With {.Interval = Speed}
  465.        ' AddHandler tmr.Tick, AddressOf Animate
  466.        ' tmr.Start()
  467.        Dim T As New Threading.Thread(AddressOf Animate)
  468.         T.IsBackground = True
  469.         'T.Start()
  470.    End Sub
  471.     Sub Animate()
  472.         While True
  473.             If OFS <= Width Then : OFS += 1
  474.             Else : OFS = 0
  475.             End If
  476.             Invalidate()
  477.             Threading.Thread.Sleep(Speed)
  478.         End While
  479.     End Sub
  480. #End Region
  481.  
  482.     Sub New()
  483.         MyBase.New()
  484.         DoubleBuffered = True
  485.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  486.         BackColor = Color.Transparent
  487.     End Sub
  488.  
  489.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  490.         Dim B As New Bitmap(Width, Height)
  491.         Dim G As Graphics = Graphics.FromImage(B)
  492.  
  493.         G.SmoothingMode = SmoothingMode.HighQuality
  494.  
  495.         Dim intValue As Integer = CInt(_Value / _Maximum * Width)
  496.         G.Clear(BackColor)
  497.  
  498.         Dim gB As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, Height - 1), Color.FromArgb(26, 26, 26), Color.FromArgb(30, 30, 30), 90S)
  499.         G.FillPath(gB, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 1))
  500.         Dim g1 As New LinearGradientBrush(New Rectangle(2, 2, intValue - 1, Height - 2), Color.FromArgb(174, 195, 30), Color.FromArgb(141, 153, 16), 90S)
  501.         G.FillPath(g1, Draw.RoundRect(New Rectangle(0, 0, intValue - 1, Height - 2), 1))
  502.         Dim h1 As New HatchBrush(HatchStyle.DarkUpwardDiagonal, Color.FromArgb(50, 174, 195, 30), Color.FromArgb(25, 141, 153, 16))
  503.         G.FillPath(h1, Draw.RoundRect(New Rectangle(0, 0, intValue - 1, Height - 2), 1))
  504.  
  505.         'G.DrawPath(New Pen(Color.FromArgb(125, 97, 94, 90)), Draw.RoundRect(New Rectangle(0, 1, Width - 1, Height - 3), 2))
  506.        G.DrawPath(New Pen(Color.FromArgb(0, 0, 0)), Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 2))
  507.  
  508.         G.DrawPath(New Pen(Color.FromArgb(150, 97, 94, 90)), Draw.RoundRect(New Rectangle(0, 0, intValue - 1, Height - 1), 2))
  509.         G.DrawPath(New Pen(Color.FromArgb(0, 0, 0)), Draw.RoundRect(New Rectangle(0, 0, intValue - 1, Height - 1), 2))
  510.  
  511.         If _ShowPercentage Then
  512.             G.DrawString(Convert.ToString(String.Concat(Value, "%")), Font, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  513.         End If
  514.  
  515.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  516.         G.Dispose() : B.Dispose()
  517.     End Sub
  518. End Class
  519. <DefaultEvent("CheckedChanged")> Public Class PerplexCheckBox : Inherits Control
  520.  
  521. #Region " Control Help - MouseState & Flicker Control"
  522.     Private State As MouseState = MouseState.None
  523.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  524.         MyBase.OnMouseEnter(e)
  525.         State = MouseState.Over
  526.         Invalidate()
  527.     End Sub
  528.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  529.         MyBase.OnMouseDown(e)
  530.         State = MouseState.Down
  531.         Invalidate()
  532.     End Sub
  533.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  534.         MyBase.OnMouseLeave(e)
  535.         State = MouseState.None
  536.         Invalidate()
  537.     End Sub
  538.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  539.         MyBase.OnMouseUp(e)
  540.         State = MouseState.Over
  541.         Invalidate()
  542.     End Sub
  543.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  544.         MyBase.OnTextChanged(e)
  545.         Invalidate()
  546.     End Sub
  547.     Private _Checked As Boolean
  548.     Property Checked() As Boolean
  549.         Get
  550.             Return _Checked
  551.         End Get
  552.         Set(ByVal value As Boolean)
  553.             _Checked = value
  554.             Invalidate()
  555.         End Set
  556.     End Property
  557.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  558.         MyBase.OnResize(e)
  559.         Height = 14
  560.     End Sub
  561.     Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  562.         _Checked = Not _Checked
  563.         RaiseEvent CheckedChanged(Me)
  564.         MyBase.OnClick(e)
  565.     End Sub
  566.     Event CheckedChanged(ByVal sender As Object)
  567. #End Region
  568.  
  569.     Sub New()
  570.         MyBase.New()
  571.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  572.         BackColor = Color.Transparent
  573.         ForeColor = Color.Black
  574.         Size = New Size(145, 16)
  575.         DoubleBuffered = True
  576.     End Sub
  577.  
  578.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  579.         Dim B As New Bitmap(Width, Height)
  580.         Dim G As Graphics = Graphics.FromImage(B)
  581.         Dim checkBoxRectangle As New Rectangle(0, 0, Height - 1, Height - 1)
  582.  
  583.         G.SmoothingMode = SmoothingMode.HighQuality
  584.         G.CompositingQuality = CompositingQuality.HighQuality
  585.  
  586.         G.Clear(BackColor)
  587.  
  588.         Dim bodyGrad As New LinearGradientBrush(checkBoxRectangle, Color.FromArgb(174, 195, 30), Color.FromArgb(141, 153, 16), 90S)
  589.         G.FillRectangle(bodyGrad, bodyGrad.Rectangle)
  590.         G.DrawRectangle(New Pen(Color.Gray), New Rectangle(1, 1, Height - 3, Height - 3))
  591.         G.DrawRectangle(New Pen(Color.Black), checkBoxRectangle)
  592.  
  593.         Dim drawFont As New Font("Tahoma", 9, FontStyle.Bold)
  594.         Dim nb As Brush = New SolidBrush(Color.FromArgb(205, 205, 205))
  595.         G.DrawString(Text, drawFont, Brushes.Black, New Point(17, 9), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  596.         G.DrawString(Text, drawFont, nb, New Point(16, 8), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  597.  
  598.         If Checked Then
  599.             Dim chkPoly As Rectangle = New Rectangle(checkBoxRectangle.X + checkBoxRectangle.Width / 4, checkBoxRectangle.Y + checkBoxRectangle.Height / 4, checkBoxRectangle.Width \ 2, checkBoxRectangle.Height \ 2)
  600.             Dim Poly() As Point = {New Point(chkPoly.X, chkPoly.Y + chkPoly.Height \ 2), _
  601.                            New Point(chkPoly.X + chkPoly.Width \ 2, chkPoly.Y + chkPoly.Height), _
  602.                            New Point(chkPoly.X + chkPoly.Width, chkPoly.Y)}
  603.             G.SmoothingMode = SmoothingMode.HighQuality
  604.             Dim P1 As New Pen(Color.FromArgb(12, 12, 12), 2)
  605.             Dim chkGrad As New LinearGradientBrush(chkPoly, Color.White, Color.White, 0S)
  606.             For i = 0 To Poly.Length - 2
  607.                 G.DrawLine(P1, Poly(i), Poly(i + 1))
  608.             Next
  609.         End If
  610.  
  611.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  612.         G.Dispose() : B.Dispose()
  613.  
  614.     End Sub
  615.  
  616. End Class
  617. <DefaultEvent("CheckedChanged")> Public Class PerplexRadioButton : Inherits Control
  618.  
  619. #Region " Control Help - MouseState & Flicker Control"
  620.     Private R1 As Rectangle
  621.     Private G1 As LinearGradientBrush
  622.  
  623.     Private State As MouseState = MouseState.None
  624.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  625.         MyBase.OnMouseEnter(e)
  626.         State = MouseState.Over
  627.         Invalidate()
  628.     End Sub
  629.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  630.         MyBase.OnMouseDown(e)
  631.         State = MouseState.Down
  632.         Invalidate()
  633.     End Sub
  634.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  635.         MyBase.OnMouseLeave(e)
  636.         State = MouseState.None
  637.         Invalidate()
  638.     End Sub
  639.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  640.         MyBase.OnMouseUp(e)
  641.         State = MouseState.Over
  642.         Invalidate()
  643.     End Sub
  644.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  645.         MyBase.OnResize(e)
  646.         Height = 16
  647.     End Sub
  648.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  649.         MyBase.OnTextChanged(e)
  650.         Invalidate()
  651.     End Sub
  652.     Private _Checked As Boolean
  653.     Property Checked() As Boolean
  654.         Get
  655.             Return _Checked
  656.         End Get
  657.         Set(ByVal value As Boolean)
  658.             _Checked = value
  659.             InvalidateControls()
  660.             RaiseEvent CheckedChanged(Me)
  661.             Invalidate()
  662.         End Set
  663.     End Property
  664.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  665.         If Not _Checked Then Checked = True
  666.         MyBase.OnClick(e)
  667.     End Sub
  668.     Event CheckedChanged(ByVal sender As Object)
  669.     Protected Overrides Sub OnCreateControl()
  670.         MyBase.OnCreateControl()
  671.         InvalidateControls()
  672.     End Sub
  673.     Private Sub InvalidateControls()
  674.         If Not IsHandleCreated OrElse Not _Checked Then Return
  675.  
  676.         For Each C As Control In Parent.Controls
  677.             If C IsNot Me AndAlso TypeOf C Is PerplexRadioButton Then
  678.                 DirectCast(C, PerplexRadioButton).Checked = False
  679.             End If
  680.         Next
  681.     End Sub
  682. #End Region
  683.  
  684.     Sub New()
  685.         MyBase.New()
  686.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  687.         BackColor = Color.Transparent
  688.         ForeColor = Color.Black
  689.         Size = New Size(150, 16)
  690.         DoubleBuffered = True
  691.     End Sub
  692.  
  693.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  694.         Dim B As New Bitmap(Width, Height)
  695.         Dim G As Graphics = Graphics.FromImage(B)
  696.         Dim radioBtnRectangle = New Rectangle(0, 0, Height - 1, Height - 1)
  697.  
  698.         G.SmoothingMode = SmoothingMode.HighQuality
  699.         G.CompositingQuality = CompositingQuality.HighQuality
  700.  
  701.         G.Clear(BackColor)
  702.  
  703.         Dim bgGrad As New LinearGradientBrush(radioBtnRectangle, Color.FromArgb(174, 195, 30), Color.FromArgb(141, 153, 16), 90S)
  704.         G.FillEllipse(bgGrad, radioBtnRectangle)
  705.  
  706.         'G.DrawEllipse(New Pen(Color.Gray), New Rectangle(1, 1, Height - 3, Height - 3))
  707.        G.DrawEllipse(New Pen(Color.Black), radioBtnRectangle)
  708.  
  709.         If Checked Then
  710.             Dim chkGrad As New LinearGradientBrush(New Rectangle(4, 4, Height - 9, Height - 9), Color.FromArgb(250, 15, 15, 15), Color.FromArgb(250, 15, 15, 15), 90S)
  711.             G.FillEllipse(chkGrad, New Rectangle(4, 4, Height - 9, Height - 9))
  712.         End If
  713.  
  714.         Dim drawFont As New Font("Tahoma", 10, FontStyle.Bold)
  715.         Dim nb As Brush = New SolidBrush(Color.FromArgb(205, 205, 205))
  716.         G.DrawString(Text, drawFont, Brushes.Black, New Point(17, 2), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  717.         G.DrawString(Text, drawFont, nb, New Point(16, 1), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  718.  
  719.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  720.         G.Dispose() : B.Dispose()
  721.     End Sub
  722.  
  723. End Class
  724. Public Class PerplexLabel : Inherits Control
  725.  
  726.     Sub New()
  727.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  728.         BackColor = Color.Transparent
  729.         ForeColor = Color.FromArgb(205, 205, 205)
  730.         DoubleBuffered = True
  731.     End Sub
  732.  
  733.     Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs)
  734.         Dim B As New Bitmap(Width, Height)
  735.         Dim G As Graphics = Graphics.FromImage(B)
  736.         Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
  737.  
  738.  
  739.         MyBase.OnPaint(e)
  740.  
  741.         G.Clear(BackColor)
  742.         Dim drawFont As New Font("Tahoma", 9, FontStyle.Bold)
  743.  
  744.         G.CompositingQuality = CompositingQuality.HighQuality
  745.         G.SmoothingMode = SmoothingMode.HighQuality
  746.  
  747.         G.DrawString(Text, drawFont, New SolidBrush(Color.FromArgb(5, 5, 5)), New Rectangle(1, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  748.         G.DrawString(Text, drawFont, New SolidBrush(Color.FromArgb(205, 205, 205)), New Rectangle(0, -1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  749.  
  750.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  751.         G.Dispose() : B.Dispose()
  752.     End Sub
  753. End Class
Add Comment
Please, Sign In to add comment