sproductions

Cypher Theme

Aug 27th, 2011
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 48.25 KB | None | 0 0
  1. Imports System.Drawing.Drawing2D
  2.  
  3.  
  4. '
  5. '
  6. 'Created By Marvinn (HF)
  7. 'Need Any help feel free to mail/pm me ([email protected])
  8. 'Please give propper credits!
  9. '15/5/2011 16:30 (Dutch/Netherlands)
  10. '
  11. '
  12.  
  13. Public Class CypherxButton
  14.     Inherits Control
  15.     Dim T As Timer
  16.     Sub New()
  17.         Font = New Font("Arial", 8)
  18.         ForeColor = FC
  19.         T = New Timer
  20.         T.Interval = _time / 10
  21.         AddHandler T.Tick, AddressOf FadeIn
  22.     End Sub
  23.     Dim _time As Integer = 200
  24.     Public Property FadeInTime As Integer
  25.         Get
  26.             Return _time
  27.         End Get
  28.         Set(ByVal value As Integer)
  29.             _time = value
  30.             T.Interval = value / 10
  31.         End Set
  32.     End Property
  33.     Dim last As Integer = 0
  34.     Dim alpha As Integer = 0
  35.     Sub FadeIn()
  36.         If alpha = 255 Then
  37.             T.Stop()
  38.             Exit Sub
  39.         End If
  40.         alpha = CalculateAlpha(last)
  41.         Invalidate()
  42.         last += 10
  43.     End Sub
  44.  
  45.     Function CalculateAlpha(ByVal Opacity As Integer) As Integer
  46.         Return (255 / 100) * Opacity
  47.     End Function
  48.     Private Enum State
  49.         MouseDown
  50.         MouseEnter
  51.         MouseLeft
  52.     End Enum
  53.  
  54.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  55.         MouseState = State.MouseLeft
  56.         Invalidate()
  57.     End Sub
  58.  
  59.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  60.         MouseState = State.MouseEnter
  61.         alpha = 0
  62.         last = 0
  63.         T.Start()
  64.     End Sub
  65.  
  66.  
  67.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  68.         MouseState = State.MouseEnter
  69.         alpha = 255
  70.         Invalidate()
  71.         MyBase.OnMouseDown(e)
  72.     End Sub
  73.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  74.         alpha = 255
  75.         Invalidate()
  76.     End Sub
  77.  
  78.     Dim GC1 As Color = Color.FromArgb(75, 75, 75)
  79.     Dim GC2 As Color = Color.FromArgb(65, 65, 65)
  80.     Dim GC3 As Color = Color.FromArgb(63, 63, 63)
  81.  
  82.     Dim GC4 As Color = Color.FromArgb(100, 100, 100)
  83.  
  84.     Dim GC5 As Color = Color.FromArgb(130, 130, 130)
  85.     Dim GC6 As Color = Color.FromArgb(120, 120, 120)
  86.  
  87.     Dim PC1 As Color = Color.FromArgb(50, 50, 50)
  88.     Dim PC2 As Color = Color.FromArgb(83, 83, 83)
  89.  
  90.     Dim FC As Color = Color.FromArgb(124, 195, 255)
  91.     Dim P As Pen
  92.     Dim MouseState As State = State.MouseLeft
  93.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  94.         Using b As New Bitmap(Width, Height)
  95.             Using g As Graphics = Graphics.FromImage(b)
  96.                 Dim OuterR As New Rectangle(0, 0, Width - 1, Height - 1)
  97.                 Dim InnerR As New Rectangle(1, 1, Width - 3, Height - 3)
  98.                 Dim UpHalf As New Rectangle(0, 0, Width, (Height - 1) / 2)
  99.                 Dim DownHalf As New Rectangle(0, (Height - 2) / 2, Width, (Height - 1) / 2)
  100.  
  101.                 Select Case MouseState
  102.                     Case State.MouseLeft
  103.                         Draw.Gradient(g, GC1, GC2, UpHalf)
  104.                         Draw.Gradient(g, GC3, GC2, DownHalf)
  105.  
  106.                         P = New Pen(PC1)
  107.                         g.DrawRectangle(P, OuterR)
  108.  
  109.                         P = New Pen(PC2)
  110.                         g.DrawRectangle(P, InnerR)
  111.                         ForeColor = FC
  112.                     Case State.MouseEnter
  113.                         If alpha < 255 Then
  114.                             Draw.Gradient(g, GC1, GC2, UpHalf)
  115.                             Draw.Gradient(g, GC3, GC2, DownHalf)
  116.                             P = New Pen(PC1)
  117.                             g.DrawRectangle(P, OuterR)
  118.                             P = New Pen(PC2)
  119.                             g.DrawRectangle(P, InnerR)
  120.                         End If
  121.  
  122.                         Draw.Gradient(g, Color.FromArgb(alpha, GC5), Color.FromArgb(alpha, GC6), UpHalf)
  123.                         Draw.Gradient(g, Color.FromArgb(alpha, GC4), Color.FromArgb(alpha, GC6), DownHalf)
  124.                         P = New Pen(PC1)
  125.                         g.DrawRectangle(P, OuterR)
  126.  
  127.                         P = New Pen(PC2)
  128.                         g.DrawRectangle(P, InnerR)
  129.                         ForeColor = Color.FromArgb(23, 32, 37)
  130.                 End Select
  131.                 Dim S As SizeF = g.MeasureString(Text, Font)
  132.                 g.DrawString(Text, Font, New SolidBrush(ForeColor), CInt(Width \ 2 - S.Width \ 2), CInt(Height \ 2 - S.Height \ 2))
  133.  
  134.                 e.Graphics.DrawImage(b.Clone, 0, 0)
  135.             End Using
  136.         End Using
  137.         MyBase.OnPaint(e)
  138.     End Sub
  139.  
  140.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  141.     End Sub
  142. End Class
  143.  
  144. Public Class CypherxTheme
  145.     Inherits Control
  146.  
  147.     Dim needtopaintbg As Boolean = True
  148.  
  149.     Protected Overrides Sub OnHandleCreated(ByVal e As System.EventArgs)
  150.         If TypeOf Parent Is Form Then
  151.             With DirectCast(Parent, Form)
  152.                 .FormBorderStyle = 0
  153.                 .BackColor = BgC
  154.                 .ForeColor = Color.White
  155.                 .Font = New Font("Arial", 8)
  156.                 Font = .Font
  157.                 ForeColor = .ForeColor
  158.                 Text = .Text
  159.                 _Icon = .Icon
  160.             End With
  161.         End If
  162.     End Sub
  163.     Sub New()
  164.         Dock = DockStyle.Fill
  165.         DoubleBuffered = True
  166.     End Sub
  167.     Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
  168.         Invalidate()
  169.         MyBase.OnSizeChanged(e)
  170.     End Sub
  171.  
  172.     Dim Balk As New Rectangle(4, 4, Width - 8, 27)
  173.  
  174.  
  175.     Dim BgC As Color = Color.FromArgb(28, 28, 28)
  176.     Dim Br As SolidBrush
  177.  
  178.     Dim PC1 As Color = Color.FromArgb(50, 50, 50)
  179.     Dim PC2 As Color = Color.FromArgb(66, 66, 66)
  180.     Dim PC3 As Color = Color.FromArgb(79, 79, 79)
  181.  
  182.     Dim BC1 As Color = Color.FromArgb(86, 86, 86)
  183.     Dim BC2 As Color = Color.FromArgb(71, 71, 71)
  184.  
  185.  
  186.  
  187.     Dim P As Pen
  188.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  189.         Using b As New Bitmap(Width, Height)
  190.             Using g As Graphics = Graphics.FromImage(b)
  191.  
  192.                 Br = New SolidBrush(BgC)
  193.                 g.FillRectangle(Br, New Rectangle(0, 0, Width, Height))
  194.  
  195.  
  196.                 P = New Pen(PC1)
  197.                 g.DrawRectangle(P, New Rectangle(0, 0, Width - 2, Height - 1))
  198.                 P = New Pen(PC2)
  199.                 g.DrawRectangle(P, New Rectangle(1, 1, Width - 3, Height - 3))
  200.                 P = New Pen(PC3, 2)
  201.                 g.DrawRectangle(P, New Rectangle(3, 3, Width - 6, Height - 6))
  202.  
  203.  
  204.  
  205.                 Dim BovenHelftBalk As New Rectangle(4, 4, Width - 8, CInt(27 / 2))
  206.                 Dim OnderHelftBalk As New Rectangle(4, CInt(27 / 2) + 2, Width - 8, CInt(27 / 2))
  207.  
  208.                 g.FillRectangle(New SolidBrush(Color.FromArgb(200, BC1)), BovenHelftBalk)
  209.                 g.FillRectangle(New SolidBrush(Color.FromArgb(150, BC2)), OnderHelftBalk)
  210.  
  211.                 g.DrawImage(ResizeIcon, New Rectangle(10, 10, 16, 16))
  212.  
  213.                 Dim S = g.MeasureString(Text, Font)
  214.                 g.DrawString(Text, New Font("Arial", 8, FontStyle.Bold), New SolidBrush(ForeColor), 36, 10)
  215.  
  216.                 Dim MinimizeRec As New Rectangle(Width - 32, 16, 9, 5)
  217.  
  218.                 If Minibox Then
  219.                     Select Case EnteredMinimize
  220.                         Case True
  221.                             g.FillRectangle(Brushes.White, MinimizeRec)
  222.                             g.DrawRectangle(New Pen(Color.FromArgb(255, Color.Black), 1), MinimizeRec)
  223.                         Case False
  224.                             g.FillRectangle(New SolidBrush(Color.FromArgb(100, Color.White)), MinimizeRec)
  225.                             g.DrawRectangle(New Pen(Color.FromArgb(150, Color.Black), 1), MinimizeRec)
  226.                     End Select
  227.                 End If
  228.  
  229.                 Select Case EntredClose
  230.                     Case True
  231.                         g.DrawString("x", New Font("Arial", 13, FontStyle.Bold), Brushes.White, Width - 20, 5)
  232.                     Case False
  233.                         Br = New SolidBrush(Color.FromArgb(100, Color.White))
  234.                         g.DrawString("x", New Font("Arial", 13, FontStyle.Bold), Br, Width - 20, 5)
  235.                 End Select
  236.  
  237.  
  238.                 e.Graphics.DrawImage(b, 0, 0)
  239.             End Using
  240.         End Using
  241.         MyBase.OnPaint(e)
  242.     End Sub
  243.  
  244.     Dim EnteredMinimize As Boolean = False
  245.     Dim EntredClose As Boolean = False
  246.  
  247.  
  248.     Function IconCheck() As Boolean
  249.         Try
  250.             If Icon.Width > 0 Then
  251.                 Return True
  252.             Else
  253.                 Return False
  254.             End If
  255.         Catch ex As Exception
  256.             Return False
  257.         End Try
  258.  
  259.     End Function
  260.     Function ResizeIcon() As Bitmap
  261.         If Not IconCheck() Then
  262.             Try
  263.                 If TypeOf Parent Is Form Then
  264.                     With DirectCast(Parent, Form)
  265.                         _Icon = .Icon
  266.                     End With
  267.                 End If
  268.             Catch ex As Exception
  269.  
  270.             End Try
  271.         End If
  272.         Try
  273.             Dim TempIcon As Icon = _Icon
  274.             Dim TempBitmap As Bitmap = New Bitmap(32, 32)
  275.             Dim BitmapGraphic As Graphics = Graphics.FromImage(TempBitmap)
  276.             Dim XPos, YPos As Integer
  277.             XPos = (TempBitmap.Width - TempIcon.Width) \ 2
  278.             YPos = (TempBitmap.Height - TempIcon.Height) \ 2
  279.  
  280.             BitmapGraphic.DrawIcon(TempIcon, New Rectangle(XPos, YPos, TempIcon.Width, TempIcon.Height))
  281.             Return TempBitmap
  282.         Catch ex As Exception
  283.             Return _Icon.ToBitmap
  284.         End Try
  285.  
  286.     End Function
  287.  
  288.     Dim _Icon As Icon
  289.     Public Property Icon As Icon
  290.         Get
  291.             Return _Icon
  292.         End Get
  293.         Set(ByVal value As Icon)
  294.             _Icon = value
  295.             If TypeOf Parent Is Form Then
  296.                 With DirectCast(Parent, Form)
  297.                     .Icon = value
  298.                     _Icon = value
  299.                     Invalidate()
  300.                 End With
  301.             End If
  302.         End Set
  303.     End Property
  304.  
  305.     Dim FadingOut As Boolean = True
  306.     Public Property UseFadeOut As Boolean
  307.         Get
  308.             Return FadingOut
  309.         End Get
  310.         Set(ByVal value As Boolean)
  311.             FadingOut = value
  312.         End Set
  313.     End Property
  314.  
  315.     Dim Minibox As Boolean = True
  316.     Public Property MinimizeBox As Boolean
  317.         Get
  318.             Return Minibox
  319.         End Get
  320.         Set(ByVal value As Boolean)
  321.             Minibox = value
  322.             Invalidate()
  323.         End Set
  324.     End Property
  325.  
  326. #Region " Global Variables "
  327.     Dim Point As New Point()
  328.     Dim X, Y As Integer
  329. #End Region
  330.  
  331. #Region " GUI "
  332.  
  333.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  334.         Dim Last As Boolean = EnteredMinimize
  335.  
  336.         Dim MinimizeRec As New Rectangle(Width - 32, 16, 9, 5)
  337.         If MinimizeRec.Contains(e.Location) Then
  338.             EnteredMinimize = True
  339.         Else
  340.             EnteredMinimize = False
  341.         End If
  342.  
  343.         If Not Last = EnteredMinimize Then
  344.             Invalidate()
  345.         End If
  346.  
  347.         Last = EntredClose
  348.  
  349.         Dim CloseRec As New Rectangle(Width - 20, 5, 16, 16)
  350.         If CloseRec.Contains(e.Location) Then
  351.             EntredClose = True
  352.         Else
  353.             EntredClose = False
  354.         End If
  355.  
  356.         If Not Last = EntredClose Then
  357.             Invalidate()
  358.         End If
  359.  
  360.         If TypeOf Parent Is Form Then
  361.             With DirectCast(Parent, Form)
  362.                 If e.Button = MouseButtons.Left And e.Location.X < Width And e.Location.Y < Balk.Height Then
  363.                     Point = Control.MousePosition
  364.                     Point.X = Point.X - (X)
  365.                     Point.Y = Point.Y - (Y)
  366.                     .Location = Point
  367.                 End If
  368.             End With
  369.         End If
  370.  
  371.         MyBase.OnMouseMove(e)
  372.     End Sub
  373.  
  374.  
  375.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  376.         If TypeOf Parent Is Form Then
  377.             With DirectCast(Parent, Form)
  378.                 X = Control.MousePosition.X - .Location.X
  379.                 Y = Control.MousePosition.Y - .Location.Y
  380.             End With
  381.         End If
  382.  
  383.         Dim MinimizeRec As New Rectangle(Width - 32, 16, 9, 5)
  384.         If MinimizeRec.Contains(e.Location) Then
  385.             If TypeOf Parent Is Form Then
  386.                 With DirectCast(Parent, Form)
  387.                     .WindowState = FormWindowState.Minimized
  388.                 End With
  389.             End If
  390.         End If
  391.  
  392.         Dim CloseRec As New Rectangle(Width - 20, 5, 16, 16)
  393.         If CloseRec.Contains(e.Location) Then
  394.             If TypeOf Parent Is Form Then
  395.                 With DirectCast(Parent, Form)
  396.                     If FadingOut Then FadeOut()
  397.                     .Close()
  398.                 End With
  399.             End If
  400.  
  401.         End If
  402.  
  403.         MyBase.OnMouseDown(e)
  404.     End Sub
  405. #End Region
  406.  
  407.     Function FadeOut()
  408.         If TypeOf Parent Is Form Then
  409.             With DirectCast(Parent, Form)
  410.                 For i As Double = 1 To 0.0 Step -0.1
  411.                     .Opacity = i
  412.                     Threading.Thread.Sleep(50)
  413.                 Next
  414.             End With
  415.         End If
  416.         Return True
  417.     End Function
  418.  
  419. End Class
  420.  
  421. Public Class CypherxLabel
  422.     Inherits Label
  423.     Dim FC As Color = Color.FromArgb(124, 195, 255)
  424.     Sub New()
  425.         Font = New Font("Arial", 8)
  426.         ForeColor = FC
  427.         BackColor = Color.Transparent
  428.     End Sub
  429. End Class
  430.  
  431. Public Class CyperxProgressbar
  432.     Inherits Control
  433.     Sub New()
  434.         Font = New Font("Arial", 8)
  435.         ForeColor = Color.White
  436.     End Sub
  437.  
  438.     Dim _UseColor As Boolean = False
  439.     Public Property Colorize As Boolean
  440.         Get
  441.             Return _UseColor
  442.         End Get
  443.         Set(ByVal value As Boolean)
  444.             _UseColor = value
  445.             Invalidate()
  446.         End Set
  447.     End Property
  448.     Dim Perc As Double = 0
  449.     Public ReadOnly Property Percentage As Double
  450.         Get
  451.             Return Perc
  452.         End Get
  453.     End Property
  454.  
  455.     Dim BC1 As Color = Color.FromArgb(90, 90, 90)
  456.     Dim BC2 As Color = Color.FromArgb(71, 71, 71)
  457.     Dim PC1 As Color = Color.FromArgb(50, 50, 50)
  458.     Dim PC2 As Color = Color.FromArgb(83, 83, 83)
  459.     Dim FC As Color = Color.FromArgb(124, 195, 255)
  460.  
  461.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  462.         Using b As New Bitmap(Width, Height)
  463.             Using g As Graphics = Graphics.FromImage(b)
  464.                 Dim WholeR As New Rectangle(0, 0, Width - 1, Height - 1)
  465.                 Draw.Gradient(g, _Lightcolor, _DarkColor, WholeR)
  466.                 g.DrawRectangle(Pens.Black, WholeR)
  467.                 Dim OneProcent As Double = Maximum / 100
  468.                 Dim ProgressProcent As Integer = _Progress / OneProcent
  469.                 Console.WriteLine(ProgressProcent)
  470.  
  471.                 Dim ProgressRec As New Rectangle(2, 2, CInt((Width - 4) * (ProgressProcent * 0.01)), Height - 4)
  472.                 Perc = _Progress / (Maximum / 100)
  473.                 Select Case _UseColor
  474.                     Case False
  475.                         g.FillRectangle(New SolidBrush(Color.FromArgb(100, Color.Black)), ProgressRec)
  476.                     Case True
  477.                         Dim Drawcolor As Color = Color.FromArgb(150, 255 - 2 * ProgressProcent, (1.7 * ProgressProcent), 0)
  478.                         g.FillRectangle(New SolidBrush(Color.FromArgb(50, Drawcolor)), ProgressRec)
  479.                 End Select
  480.  
  481.                 If Showt Then g.DrawString(Text, Font, New SolidBrush(ForeColor), New Point(3, 4))
  482.                 e.Graphics.DrawImage(b, 0, 0)
  483.             End Using
  484.         End Using
  485.     End Sub
  486.  
  487.  
  488.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  489.     End Sub
  490.  
  491. #Region " Properties "
  492.  
  493.     Dim Showt As Boolean = True
  494.     Public Property ShowText As Boolean
  495.         Get
  496.             Return Showt
  497.         End Get
  498.         Set(ByVal value As Boolean)
  499.             Showt = value
  500.             Invalidate()
  501.         End Set
  502.     End Property
  503.     Private _Maximum As Double = 100
  504.     Public Property Maximum() As Double
  505.         Get
  506.             Return _Maximum
  507.         End Get
  508.         Set(ByVal value As Double)
  509.             _Maximum = value
  510.             value = _Current / value * 100
  511.             Invalidate()
  512.         End Set
  513.     End Property
  514.  
  515.     Private _Current As Double
  516.     Public Property Current() As Double
  517.         Get
  518.             Return _Current
  519.         End Get
  520.         Set(ByVal value As Double)
  521.             _Current = value
  522.             value = value / _Maximum * 100
  523.             Invalidate()
  524.         End Set
  525.     End Property
  526.  
  527.     Private _Progress As Integer
  528.     Public Property Value() As Double
  529.         Get
  530.             Return _Progress
  531.         End Get
  532.         Set(ByVal value As Double)
  533.             If value < 0 Then value = 0 Else If value > Maximum Then value = Maximum
  534.             _Progress = CInt(value)
  535.             _Current = value * 0.01 * _Maximum
  536.             Invalidate()
  537.         End Set
  538.     End Property
  539.  
  540.     Public Property DarkColor As Color
  541.  
  542.         Get
  543.             Return _DarkColor
  544.  
  545.         End Get
  546.         Set(ByVal value As Color)
  547.             _DarkColor = value
  548.             Invalidate()
  549.         End Set
  550.     End Property
  551.  
  552.     Public Property Lightcolor() As Color
  553.         Get
  554.             Return _Lightcolor
  555.         End Get
  556.         Set(ByVal value As Color)
  557.             _Lightcolor = value
  558.             Invalidate()
  559.         End Set
  560.     End Property
  561.  
  562. #End Region
  563.  
  564. #Region " Colors "
  565.     Dim _Lightcolor As Color = BC2
  566.     Dim _DarkColor = BC1
  567. #End Region
  568.  
  569.  
  570. End Class
  571.  
  572. Public Class CyperxTextbox
  573.  
  574.     Inherits Control
  575.  
  576.     Dim Bg As Color = Color.FromArgb(28, 28, 28)
  577.     Dim PC2 As Color = Color.FromArgb(83, 83, 83)
  578.     Dim FC As Color = Color.FromArgb(124, 195, 255)
  579.     Dim tbox As TextBox
  580.     Sub New()
  581.         Me.Text = ""
  582.         tbox = Nothing
  583.         tbox = New TextBox
  584.         tbox.Text = Text
  585.         tbox.BorderStyle = BorderStyle.None
  586.         tbox.BackColor = Bg
  587.         tbox.Location = New Point(3, 4)
  588.         tbox.Width = Width - 7
  589.         tbox.Font = Font
  590.         tbox.UseSystemPasswordChar = Pwbox
  591.         tbox.ForeColor = FC
  592.         Me.Controls.Add(tbox)
  593.         AddHandler tbox.TextChanged, AddressOf TextChange
  594.     End Sub
  595.     Dim Pwbox As Boolean = False
  596.  
  597.     Dim DrawRounded As Boolean = True
  598.     Public Property Rounded As Boolean
  599.         Get
  600.             Return DrawRounded
  601.         End Get
  602.         Set(ByVal value As Boolean)
  603.             DrawRounded = value
  604.         End Set
  605.     End Property
  606.  
  607.     Public Property UseSystemPasswordChar As Boolean
  608.         Get
  609.             Return Pwbox
  610.         End Get
  611.         Set(ByVal value As Boolean)
  612.             Pwbox = value
  613.             tbox = Nothing
  614.             tbox = New TextBox
  615.             tbox.Text = Text
  616.             tbox.BorderStyle = BorderStyle.None
  617.             tbox.BackColor = Bg
  618.             tbox.Location = New Point(3, 4)
  619.             tbox.Width = Width - 7
  620.             tbox.Font = Font
  621.             tbox.UseSystemPasswordChar = Pwbox
  622.             tbox.ForeColor = FC
  623.             Me.Controls.Add(tbox)
  624.             AddHandler tbox.TextChanged, AddressOf TextChange
  625.         End Set
  626.     End Property
  627.  
  628.     Private Sub TextChange()
  629.         Me.Text = tbox.Text
  630.     End Sub
  631.  
  632.     Dim p As Pen
  633.     Dim sb As SolidBrush
  634.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  635.         Using b As New Bitmap(Width, Height)
  636.             Using g As Graphics = Graphics.FromImage(b)
  637.                 sb = New SolidBrush(Bg)
  638.                 g.FillRectangle(sb, New Rectangle(0, 0, Width, Height))
  639.                 p = New Pen(PC2)
  640.                 If DrawRounded Then
  641.                     Dim Outline As GraphicsPath = Draw.RoundedRectangle(0, 0, Width - 1, Height - 1, 10, 1)
  642.                     g.DrawPath(p, Outline)
  643.                 Else
  644.                     Dim rec As New Rectangle(0, 0, Width - 1, Height - 1)
  645.                     g.DrawRectangle(p, rec)
  646.                 End If
  647.                 e.Graphics.DrawImage(b, 0, 0)
  648.             End Using
  649.         End Using
  650.         MyBase.OnPaint(e)
  651.     End Sub
  652. End Class
  653.  
  654. Public Class CypherxGroupBox
  655.     Inherits Panel
  656.     Dim Bg As Color = Color.FromArgb(28, 28, 28)
  657.     Dim PC2 As Color = Color.FromArgb(83, 83, 83)
  658.     Dim FC As Color = Color.FromArgb(124, 195, 255)
  659.     Dim p As Pen
  660.     Dim sb As SolidBrush
  661.     Sub New()
  662.         BackColor = Bg
  663.     End Sub
  664.     Dim _t As String = ""
  665.     Public Property Header As String
  666.         Get
  667.             Return _t
  668.         End Get
  669.         Set(ByVal value As String)
  670.             _t = value
  671.             Invalidate()
  672.         End Set
  673.     End Property
  674.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  675.         Using b As New Bitmap(Width, Height)
  676.             Using g As Graphics = Graphics.FromImage(b)
  677.                 p = New Pen(PC2)
  678.                 sb = New SolidBrush(Bg)
  679.                 Dim M As SizeF = g.MeasureString(_t, Font)
  680.                 Dim Outline As GraphicsPath = Draw.RoundedRectangle(0, M.Height / 2, Width - 1, Height - 1, 10, 1)
  681.                 g.Clear(BackColor)
  682.                 g.FillRectangle(sb, New Rectangle(0, M.Height / 2, Width - 1, Height - 1))
  683.                 g.DrawPath(p, Outline)
  684.  
  685.                 g.FillRectangle(sb, New Rectangle(10, (M.Height / 2) - 2, M.Width + 10, M.Height))
  686.                 sb = New SolidBrush(FC)
  687.                 g.DrawString(_t, Font, sb, 12, 2)
  688.                 e.Graphics.DrawImage(b, 0, 0)
  689.             End Using
  690.         End Using
  691.         MyBase.OnPaint(e)
  692.     End Sub
  693. End Class
  694.  
  695. Public Class CyperxSeperator
  696.     Inherits Control
  697.     Dim Bg As Color = Color.FromArgb(28, 28, 28)
  698.     Dim PC2 As Color = Color.FromArgb(83, 83, 83)
  699.     Dim FC As Color = Color.FromArgb(124, 195, 255)
  700.     Dim p As Pen
  701.     Dim sb As SolidBrush
  702.  
  703.     Public Enum Direction
  704.         Horizontal
  705.         Vertical
  706.     End Enum
  707.     Dim Dir As Direction = Direction.Horizontal
  708.     Public Property Style As DIRECTION
  709.         Get
  710.             Return Dir
  711.         End Get
  712.         Set(ByVal value As DIRECTION)
  713.             Dir = value
  714.             Invalidate()
  715.         End Set
  716.     End Property
  717.  
  718.     Dim H As Integer = 2
  719.     Public Property Thickness As Integer
  720.         Get
  721.             Return H
  722.         End Get
  723.         Set(ByVal value As Integer)
  724.             H = value
  725.             Invalidate()
  726.         End Set
  727.     End Property
  728.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  729.     End Sub
  730.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  731.         Using b As New Bitmap(Width, Height)
  732.             Using g As Graphics = Graphics.FromImage(b)
  733.                 g.Clear(BackColor)
  734.  
  735.                 sb = New SolidBrush(Bg)
  736.                 g.FillRectangle(sb, New Rectangle(0, 0, Width, Height))
  737.                 Select Case Dir
  738.                     Case Direction.Horizontal
  739.  
  740.  
  741.                         Dim GRec As New Rectangle(0, Height / 2, Width / 5, H)
  742.                         Using GBrush As LinearGradientBrush = New LinearGradientBrush(GRec, Color.Transparent, FC, LinearGradientMode.Horizontal)
  743.                             g.FillRectangle(GBrush, GRec)
  744.                         End Using
  745.                         p = New Pen(FC, H)
  746.                         Dim x As Integer = Math.Floor(H / 2)
  747.                         g.DrawLine(p, New Point(GRec.Width, GRec.Y + x), New Point(Width - GRec.Width + 1, GRec.Y + x))
  748.  
  749.                         GRec = New Rectangle(Width - (Width / 5), Height / 2, Width / 5, H)
  750.                         Using GBrush As LinearGradientBrush = New LinearGradientBrush(GRec, FC, Color.Transparent, LinearGradientMode.Horizontal)
  751.                             g.FillRectangle(GBrush, GRec)
  752.                         End Using
  753.  
  754.                     Case Direction.Vertical
  755.  
  756.                         Dim GRec As New Rectangle(Width / 2, 0, H, Height / 5)
  757.                         Using GBrush As LinearGradientBrush = New LinearGradientBrush(GRec, Color.Transparent, FC, LinearGradientMode.Vertical)
  758.                             g.FillRectangle(GBrush, GRec)
  759.                         End Using
  760.  
  761.                         p = New Pen(FC, H)
  762.                         Dim x As Integer = Math.Floor(H / 2)
  763.  
  764.                         g.DrawLine(p, New Point(GRec.X + x, Height / 5), New Point(GRec.X + x, Height - (Height / 5)))
  765.  
  766.                         GRec = New Rectangle(GRec.X, Height - (Height / 5) - 1, H, Height / 5)
  767.  
  768.                         Using GBrush As LinearGradientBrush = New LinearGradientBrush(GRec, FC, Color.Transparent, LinearGradientMode.Vertical)
  769.                             g.FillRectangle(GBrush, GRec)
  770.                         End Using
  771.                 End Select
  772.              
  773.                 e.Graphics.DrawImage(b, 0, 0)
  774.             End Using
  775.         End Using
  776.         MyBase.OnPaint(e)
  777.     End Sub
  778.  
  779. End Class
  780.  
  781. Public Class CyperxComboBox
  782.     Inherits Control
  783.     Dim t As Timer
  784.     Sub New()
  785.         Font = New Font("Arial", 8)
  786.         ForeColor = Color.White
  787.         MinimumSize = New Size(130, 23)
  788.         t = New Timer
  789.         t.Interval = _time / 10
  790.         AddHandler t.Tick, AddressOf FadeIn
  791.     End Sub
  792.  
  793.     Dim _time As Integer = 200
  794.     Public Property FadeInTime As Integer
  795.         Get
  796.             Return _time
  797.         End Get
  798.         Set(ByVal value As Integer)
  799.             _time = value
  800.             t.Interval = value / 10
  801.         End Set
  802.     End Property
  803.     Dim last As Integer = 0
  804.     Dim alpha As Integer = 0
  805.     Sub FadeIn()
  806.         If alpha = 255 Then
  807.             T.Stop()
  808.             Exit Sub
  809.         End If
  810.         alpha = CalculateAlpha(last)
  811.         Invalidate()
  812.         last += 10
  813.     End Sub
  814.  
  815.     Function CalculateAlpha(ByVal Opacity As Integer) As Integer
  816.         Return (255 / 100) * Opacity
  817.     End Function
  818.  
  819.     Dim LastItems() As String
  820.     Protected Overrides Sub OnHandleCreated(ByVal e As System.EventArgs)
  821.         Try
  822.             If _Items.Length = 0 Then _Items = New String() {Text}
  823.         Catch ex As Exception
  824.             _Items = New String() {Text}
  825.         End Try
  826.         LastItems = _Items
  827.         pop = New Popup(_Items)
  828.         pop.Location = New Point(Location.X, Location.Y + Height + 2)
  829.         pop.Visible = False
  830.         Invoke(New AddX(AddressOf AddControl), pop)
  831.         MyBase.OnHandleCreated(e)
  832.     End Sub
  833.     Private Enum State
  834.         MouseDown = 0
  835.         MouseEnter = 1
  836.         MouseLeft = 2
  837.         Wait = 3
  838.     End Enum
  839.  
  840.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  841.         If Not MouseState = State.Wait Then
  842.             MouseState = State.MouseLeft
  843.             alpha = 0
  844.             last = 0
  845.             Invalidate()
  846.         End If
  847.     End Sub
  848.  
  849.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  850.         If Not MouseState = State.Wait Then
  851.             MouseState = State.MouseEnter
  852.             t.Start()
  853.         End If
  854.     End Sub
  855.  
  856.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  857.         If Not MouseState = State.Wait Then
  858.             MouseState = State.MouseEnter
  859.             Invalidate()
  860.         End If
  861.     End Sub
  862.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  863.         MouseState = State.Wait
  864.         t.Stop()
  865.         alpha = 255
  866.         Dim ShowPopup As New Threading.Thread(AddressOf ShowAndWait)
  867.         ShowPopup.Start()
  868.         Invalidate()
  869.         MyBase.OnMouseDown(e)
  870.     End Sub
  871.     Dim pop As Popup
  872.  
  873.     Delegate Sub ShowPopD(ByVal shown As Boolean)
  874.     Sub ShowPop(ByVal show As Boolean)
  875.         pop.Visible = show
  876.     End Sub
  877.     Sub ShowAndWait()
  878.         If pop.Showing Then Exit Sub
  879.         pop = Nothing
  880.         pop = New Popup(_Items)
  881.         pop.Location = New Point(Location.X, Location.Y + Height + 2)
  882.         Invoke(New AddX(AddressOf AddControl), pop)
  883.  
  884.         pop.WaitForInput()
  885.         alpha = 0
  886.         last = 0
  887.         MouseState = State.MouseLeft
  888.         If Not pop.SelectedItem = "" Then
  889.             Invoke(New UpdateTextD(AddressOf UpdateText), pop.SelectedItem)
  890.         Else
  891.             Invoke(New UpdateTextD(AddressOf UpdateText), Text)
  892.         End If
  893.     End Sub
  894.  
  895.     Delegate Sub UpdateTextD(ByVal text As String)
  896.     Sub UpdateText(ByVal text As String)
  897.         Me.Text = text
  898.         Invalidate()
  899.     End Sub
  900.  
  901.     Delegate Sub AddX(ByVal control As Control)
  902.     Sub AddControl(ByVal control As Control)
  903.         Parent.Controls.Add(control)
  904.     End Sub
  905.     Dim _Items() As String
  906.     Public Property Items As String()
  907.         Get
  908.             Return _Items
  909.         End Get
  910.         Set(ByVal value As String())
  911.             _Items = value
  912.             Invalidate()
  913.         End Set
  914.     End Property
  915.     Dim MouseState As State = State.MouseLeft
  916.  
  917.  
  918.     Dim GC1 As Color = Color.FromArgb(75, 75, 75)
  919.     Dim GC2 As Color = Color.FromArgb(65, 65, 65)
  920.     Dim GC3 As Color = Color.FromArgb(63, 63, 63)
  921.  
  922.     Dim GC4 As Color = Color.FromArgb(100, 100, 100)
  923.  
  924.     Dim GC5 As Color = Color.FromArgb(130, 130, 130)
  925.     Dim GC6 As Color = Color.FromArgb(120, 120, 120)
  926.  
  927.     Dim PC1 As Color = Color.FromArgb(50, 50, 50)
  928.     Dim PC2 As Color = Color.FromArgb(83, 83, 83)
  929.  
  930.     Dim FC As Color = Color.FromArgb(124, 195, 255)
  931.     Dim P As Pen
  932.  
  933.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  934.         Using b As New Bitmap(Width, Height)
  935.             Using g As Graphics = Graphics.FromImage(b)
  936.                 Dim OuterR As New Rectangle(0, 0, Width - 1, Height - 1)
  937.                 Dim InnerR As New Rectangle(1, 1, Width - 3, Height - 3)
  938.                 Dim UpHalf As New Rectangle(2, 2, Width - 3, (Height - 1) / 2)
  939.                 Dim DownHalf As New Rectangle(2, (Height - 1) / 2, Width - 3, (Height - 1) / 2)
  940.  
  941.                 Select Case MouseState
  942.                     Case State.MouseLeft
  943.                         Draw.Gradient(g, GC1, GC2, UpHalf)
  944.                         Draw.Gradient(g, GC3, GC2, DownHalf)
  945.  
  946.                         P = New Pen(PC1)
  947.                         g.DrawRectangle(P, OuterR)
  948.  
  949.                         P = New Pen(PC2)
  950.                         g.DrawRectangle(P, InnerR)
  951.                         ForeColor = FC
  952.                     Case State.MouseEnter
  953.                         If alpha < 255 Then
  954.                             Draw.Gradient(g, GC1, GC2, UpHalf)
  955.                             Draw.Gradient(g, GC3, GC2, DownHalf)
  956.                             P = New Pen(PC1)
  957.                             g.DrawRectangle(P, OuterR)
  958.                             P = New Pen(PC2)
  959.                             g.DrawRectangle(P, InnerR)
  960.                         End If
  961.  
  962.                         Draw.Gradient(g, Color.FromArgb(alpha, GC5), Color.FromArgb(alpha, GC6), UpHalf)
  963.                         Draw.Gradient(g, Color.FromArgb(alpha, GC4), Color.FromArgb(alpha, GC6), DownHalf)
  964.                         P = New Pen(PC1)
  965.                         g.DrawRectangle(P, OuterR)
  966.  
  967.                         P = New Pen(PC2)
  968.                         g.DrawRectangle(P, InnerR)
  969.                         ForeColor = Color.FromArgb(23, 32, 37)
  970.                     Case State.Wait
  971.                         Draw.Gradient(g, Color.FromArgb(alpha, GC5), Color.FromArgb(alpha, GC6), UpHalf)
  972.                         Draw.Gradient(g, Color.FromArgb(alpha, GC4), Color.FromArgb(alpha, GC6), DownHalf)
  973.                         P = New Pen(PC1)
  974.                         g.DrawRectangle(P, OuterR)
  975.  
  976.                         P = New Pen(PC2)
  977.                         g.DrawRectangle(P, InnerR)
  978.                         ForeColor = Color.FromArgb(23, 32, 37)
  979.                 End Select
  980.  
  981.  
  982.                 If ShowS Then
  983.                     Dim UpRec As New Rectangle(Width - 18, 2, 1, 5)
  984.                     Draw.Gradient(g, Color.Transparent, PC2, UpRec)
  985.                     P = New Pen(PC2)
  986.  
  987.                     g.DrawLine(P, New Point(Width - 18, 7), New Point(Width - 18, Height - 7))
  988.                     Draw.Gradient(g, PC2, Color.Transparent, New Rectangle(Width - 18, Height - 7, 1, 5))
  989.                 End If
  990.                 P = New Pen(Brushes.White, 2)
  991.                 g.DrawLine(P, New Point(Width - 15, 9), New Point(Width - 10, 14))
  992.                 g.DrawLine(P, New Point(Width - 5, 9), New Point(Width - 10, 14))
  993.  
  994.                 Dim S As SizeF = g.MeasureString(Text, Font)
  995.                 g.DrawString(Text, Font, New SolidBrush(ForeColor), 5, CInt(Height / 2 - S.Height / 2))
  996.  
  997.                 e.Graphics.DrawImage(b.Clone, 0, 0)
  998.             End Using
  999.         End Using
  1000.         MyBase.OnPaint(e)
  1001.     End Sub
  1002.  
  1003.     Dim ShowS As Boolean = True
  1004.     Public Property ShowSeperator As Boolean
  1005.         Get
  1006.             Return ShowS
  1007.         End Get
  1008.         Set(ByVal value As Boolean)
  1009.             ShowS = value
  1010.             Invalidate()
  1011.         End Set
  1012.     End Property
  1013.  
  1014.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  1015.     End Sub
  1016. End Class
  1017.  
  1018. Public Class Popup
  1019.     Inherits Control
  1020.     Dim _items() As String
  1021.     Dim ListOfRec As New List(Of Rectangle)
  1022.  
  1023.     Sub New()
  1024.         Throw New Exception("You can't add this direct to the Designer!")
  1025.     End Sub
  1026.     Sub New(ByVal items As String())
  1027.         DoubleBuffered = True
  1028.         _items = items
  1029.         FixWidth()
  1030.         FixList()
  1031.  
  1032.     End Sub
  1033.     Protected Overrides Sub OnHandleCreated(ByVal e As System.EventArgs)
  1034.         Console.WriteLine(TopLevelControl.TopLevelControl)
  1035.         BringToFront()
  1036.         Shown = True
  1037.         MyBase.OnHandleCreated(e)
  1038.     End Sub
  1039.     Dim MyMousedown As Boolean = False
  1040.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  1041.         MyMousedown = True
  1042.         Invalidate()
  1043.         _item = Temp_item
  1044.         Console.WriteLine("Item: " & SelectedItem)
  1045.         Input = True
  1046.         Shown = False
  1047.         Visible = False
  1048.         MyBase.OnMouseDown(e)
  1049.     End Sub
  1050.  
  1051.     Sub FixWidth()
  1052.         Dim G As Graphics = Graphics.FromImage(New Bitmap(1, 1))
  1053.         Dim LongestWidth As Integer = 0
  1054.         For Each Str As String In _items
  1055.             If G.MeasureString(Str, Font).Width > LongestWidth Then
  1056.                 LongestWidth = G.MeasureString(Str, Font).Width
  1057.             End If
  1058.         Next
  1059.  
  1060.         If LongestWidth < 85 Then
  1061.             Width = 95
  1062.         Else
  1063.             Me.Width = LongestWidth + 9
  1064.         End If
  1065.  
  1066.     End Sub
  1067.  
  1068.     Dim Shown As Boolean = False
  1069.     Public ReadOnly Property Showing As Boolean
  1070.         Get
  1071.             Return Shown
  1072.         End Get
  1073.     End Property
  1074.     Sub FixList()
  1075.         Dim MyHeight = 23 * _items.Length - 1
  1076.         Dim AantalRecs As Integer = MyHeight / 23
  1077.         ListOfRec.Add(New Rectangle(2, 3, Width - 5, 23))
  1078.         For i As Integer = 1 To AantalRecs
  1079.             Dim rec As New Rectangle(2, 23 * i, Width - 5, 23)
  1080.             ListOfRec.Add(rec)
  1081.         Next
  1082.  
  1083.         Me.Height = MyHeight + 5
  1084.         Invalidate()
  1085.     End Sub
  1086.     Dim SelectedReg As New Rectangle(0, 0, 0, 0)
  1087.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  1088.         Dim Oldrec As Rectangle = SelectedReg
  1089.         For Each rec As Rectangle In ListOfRec
  1090.             If rec.Contains(e.Location) Then
  1091.                 SelectedReg = rec
  1092.             End If
  1093.         Next
  1094.         If Not Oldrec = SelectedReg Then
  1095.             Invalidate()
  1096.         End If
  1097.         MyBase.OnMouseMove(e)
  1098.     End Sub
  1099.  
  1100.     Dim Input As Boolean = False
  1101.     Public Sub WaitForInput()
  1102.         Do While Input = False
  1103.             Threading.Thread.Sleep(1)
  1104.         Loop
  1105.     End Sub
  1106.  
  1107.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  1108.         SelectedReg = New Rectangle(0, 0, 0, 0)
  1109.         Me.Visible = False
  1110.         Input = True
  1111.         Shown = False
  1112.         MyBase.OnMouseLeave(e)
  1113.     End Sub
  1114.  
  1115.     Dim _item As String = ""
  1116.     Public Property SelectedItem As String
  1117.         Get
  1118.             Return _item
  1119.         End Get
  1120.         Set(ByVal value As String)
  1121.             _item = value
  1122.         End Set
  1123.     End Property
  1124.  
  1125.     Dim BC1 As Color = Color.FromArgb(90, 90, 90)
  1126.     Dim BC2 As Color = Color.FromArgb(71, 71, 71)
  1127.     Dim PC1 As Color = Color.FromArgb(50, 50, 50)
  1128.     Dim PC2 As Color = Color.FromArgb(83, 83, 83)
  1129.     Dim FC As Color = Color.FromArgb(124, 195, 255)
  1130.  
  1131.     Dim SB As SolidBrush
  1132.     Dim p As Pen
  1133.  
  1134.     Dim Temp_item As String = ""
  1135.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1136.         Using b As New Bitmap(Width, Height)
  1137.             Using g As Graphics = Graphics.FromImage(b)
  1138.  
  1139.                 Dim Fullrec As New Rectangle(0, 0, Width - 1, Height - 1)
  1140.                 SB = New SolidBrush(BC2)
  1141.                 p = New Pen(PC2)
  1142.                 g.FillRectangle(SB, Fullrec)
  1143.                 g.DrawRectangle(p, Fullrec)
  1144.                 SB = New SolidBrush(BC1)
  1145.  
  1146.                 g.FillRectangle(SB, SelectedReg)
  1147.                 p = New Pen(FC)
  1148.                 g.DrawRectangle(p, SelectedReg)
  1149.  
  1150.  
  1151.                 If SelectedReg.Contains(New Point(5, 5)) Then
  1152.                     SB = New SolidBrush(FC)
  1153.                     g.DrawString(_items(0), Font, SB, 5, 7)
  1154.                     Console.WriteLine("Selected item " & _items(0))
  1155.                     Temp_item = _items(0)
  1156.                 Else
  1157.                     g.DrawString(_items(0), Font, Brushes.White, 5, 7)
  1158.                 End If
  1159.  
  1160.  
  1161.                 For I As Integer = 1 To _items.Length - 1
  1162.                     If SelectedReg.Contains(New Point(5, I * 23 + 5)) Then
  1163.                         SB = New SolidBrush(FC)
  1164.                         g.DrawString(_items(I), Font, SB, 5, I * 23 + 5)
  1165.                         Console.WriteLine("Selected item: " & _items(I))
  1166.                         Temp_item = _items(I)
  1167.                     Else
  1168.                         g.DrawString(_items(I), Font, Brushes.White, 5, I * 23 + 5)
  1169.                     End If
  1170.                 Next
  1171.                 e.Graphics.DrawImage(b, 0, 0)
  1172.             End Using
  1173.         End Using
  1174.         MyBase.OnPaint(e)
  1175.     End Sub
  1176.  
  1177. End Class
  1178.  
  1179. Public Class CyperxCheckbox
  1180.     Inherits Control
  1181.     Dim Bg As Color = Color.FromArgb(28, 28, 28)
  1182.     Dim PC1 As Color = Color.FromArgb(50, 50, 50)
  1183.     Dim PC2 As Color = Color.FromArgb(83, 83, 83)
  1184.     Dim FC As Color = Color.FromArgb(124, 195, 255)
  1185.     Dim BC1 As Color = Color.FromArgb(86, 86, 86)
  1186.     Dim BC2 As Color = Color.FromArgb(71, 71, 71)
  1187.     Dim sb As SolidBrush
  1188.     Dim p As Pen
  1189.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1190.         Using b As New Bitmap(Width, Height)
  1191.             Using g As Graphics = Graphics.FromImage(b)
  1192.                 g.FillRectangle(New SolidBrush(Bg), New Rectangle(0, 0, Width, Height))
  1193.                 'g.DrawArc(Pens.White, New Rectangle(0, 0, Width, Height), 90, 90)
  1194.                 Dim GRec As New Rectangle(0, 0, Width, Height)
  1195.                 Dim XB As New Bitmap(Width, Height)
  1196.                 Dim XBG As Graphics = Graphics.FromImage(XB)
  1197.  
  1198.                 Using GBrush As LinearGradientBrush = New LinearGradientBrush(GRec, Color.Transparent, PC2, LinearGradientMode.Vertical)
  1199.                     XBG.FillEllipse(GBrush, GRec)
  1200.                 End Using
  1201.  
  1202.                 XBG.FillRectangle(New SolidBrush(Bg), New Rectangle(0, Height / 2, Width, Height / 2))
  1203.                 g.DrawImage(XB, 0, 0)
  1204.                 ' g.FillEllipse(Brushes.Brown, New Rectangle(0, 0, Width, Height))
  1205.                 'g.DrawLine(p, New Point(4, 8), New Point(6, 12))
  1206.                 'g.DrawLine(p, New Point(6, 12), New Point(10, 4))
  1207.                 e.Graphics.DrawImage(b, 0, 0)
  1208.             End Using
  1209.         End Using
  1210.         MyBase.OnPaint(e)
  1211.     End Sub
  1212.  
  1213.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  1214.     End Sub
  1215. End Class
  1216.  
  1217.  
  1218. '
  1219. '
  1220. 'Created By Aeonhack
  1221. '
  1222. '
  1223. Public Class Draw
  1224.     Shared Sub Gradient(ByVal g As Graphics, ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1225.         Dim R As New Rectangle(x, y, width, height)
  1226.         Using T As New LinearGradientBrush(R, c1, c2, LinearGradientMode.Vertical)
  1227.             g.FillRectangle(T, R)
  1228.         End Using
  1229.     End Sub
  1230.     Shared Sub Gradient(ByVal g As Graphics, ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1231.         Using T As New LinearGradientBrush(R, c1, c2, LinearGradientMode.Vertical)
  1232.             g.FillRectangle(T, R)
  1233.         End Using
  1234.     End Sub
  1235.     Shared Sub Blend(ByVal g As Graphics, ByVal c1 As Color, ByVal c2 As Color, ByVal c3 As Color, ByVal c As Single, ByVal d As Integer, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1236.         Dim v As New ColorBlend(3)
  1237.         V.Colors = New Color() {c1, c2, c3}
  1238.         V.Positions = New Single() {0, c, 1}
  1239.         Dim R As New Rectangle(x, y, width, height)
  1240.         Using T As New LinearGradientBrush(R, c1, c1, CType(d, LinearGradientMode))
  1241.             T.InterpolationColors = v : g.FillRectangle(T, R)
  1242.         End Using
  1243.     End Sub
  1244.     Shared Function RoundedRectangle(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal cornerwidth As Integer, ByVal PenWidth As Integer) As GraphicsPath
  1245.         Dim p As New GraphicsPath
  1246.         p.StartFigure()
  1247.         p.AddArc(New Rectangle(x, y, cornerwidth, cornerwidth), 180, 90)
  1248.         p.AddLine(cornerwidth, y, width - cornerwidth - PenWidth, y)
  1249.  
  1250.         p.AddArc(New Rectangle(width - cornerwidth - PenWidth, y, cornerwidth, cornerwidth), -90, 90)
  1251.         p.AddLine(width - PenWidth, cornerwidth, width - PenWidth, height - cornerwidth - PenWidth)
  1252.  
  1253.         p.AddArc(New Rectangle(width - cornerwidth - PenWidth, height - cornerwidth - PenWidth, cornerwidth, cornerwidth), 0, 90)
  1254.         p.AddLine(width - cornerwidth - PenWidth, height - PenWidth, cornerwidth, height - PenWidth)
  1255.  
  1256.         p.AddArc(New Rectangle(x, height - cornerwidth - PenWidth, cornerwidth, cornerwidth), 90, 90)
  1257.         p.CloseFigure()
  1258.  
  1259.         Return p
  1260.     End Function
  1261.  
  1262.     Shared Sub BackGround(ByVal width As Integer, ByVal height As Integer, ByVal G As Graphics)
  1263.  
  1264.         Dim P1 As Color = Color.FromArgb(29, 25, 22)
  1265.         Dim P2 As Color = Color.FromArgb(35, 31, 28)
  1266.  
  1267.         For y As Integer = 0 To height Step 4
  1268.             For x As Integer = 0 To width Step 4
  1269.                 G.FillRectangle(New SolidBrush(P1), New Rectangle(x, y, 1, 1))
  1270.                 G.FillRectangle(New SolidBrush(P2), New Rectangle(x, y + 1, 1, 1))
  1271.                 Try
  1272.                     G.FillRectangle(New SolidBrush(P1), New Rectangle(x + 2, y + 2, 1, 1))
  1273.                     G.FillRectangle(New SolidBrush(P2), New Rectangle(x + 2, y + 3, 1, 1))
  1274.                 Catch
  1275.                 End Try
  1276.             Next
  1277.         Next
  1278.     End Sub
  1279. End Class
  1280.  
  1281. Public Class CypherxButtonV2
  1282.     Inherits Control
  1283.     Dim T As Timer
  1284.     Sub New()
  1285.         Font = New Font("Arial", 8)
  1286.         ForeColor = FC
  1287.         T = New Timer
  1288.         T.Interval = _time / 10
  1289.         AddHandler T.Tick, AddressOf FadeIn
  1290.     End Sub
  1291.     Dim _time As Integer = 200
  1292.     Public Property FadeInTime As Integer
  1293.         Get
  1294.             Return _time
  1295.         End Get
  1296.         Set(ByVal value As Integer)
  1297.             _time = value
  1298.             T.Interval = value / 10
  1299.         End Set
  1300.     End Property
  1301.     Dim last As Integer = 0
  1302.     Dim alpha As Integer = 0
  1303.     Sub FadeIn()
  1304.         If alpha = 255 Then
  1305.             T.Stop()
  1306.             Exit Sub
  1307.         End If
  1308.         alpha = CalculateAlpha(last)
  1309.         Invalidate()
  1310.         last += 10
  1311.     End Sub
  1312.  
  1313.     Function CalculateAlpha(ByVal Opacity As Integer) As Integer
  1314.         Return (255 / 100) * Opacity
  1315.     End Function
  1316.     Private Enum State
  1317.         MouseDown
  1318.         MouseEnter
  1319.         MouseLeft
  1320.     End Enum
  1321.  
  1322.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  1323.         MouseState = State.MouseLeft
  1324.         Invalidate()
  1325.     End Sub
  1326.  
  1327.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  1328.         MouseState = State.MouseEnter
  1329.         alpha = 0
  1330.         last = 0
  1331.         T.Start()
  1332.     End Sub
  1333.  
  1334.  
  1335.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  1336.         MouseState = State.MouseDown
  1337.         alpha = 0
  1338.         last = 0
  1339.         T.Start()
  1340.         MyBase.OnMouseDown(e)
  1341.     End Sub
  1342.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  1343.         alpha = 255
  1344.         MouseState = State.MouseEnter
  1345.         Invalidate()
  1346.     End Sub
  1347.  
  1348.     Dim GC1 As Color = Color.FromArgb(75, 75, 75)
  1349.     Dim GC2 As Color = Color.FromArgb(65, 65, 65)
  1350.     Dim GC3 As Color = Color.FromArgb(63, 63, 63)
  1351.  
  1352.     Dim GC4 As Color = Color.FromArgb(100, 100, 100)
  1353.  
  1354.     Dim GC5 As Color = Color.FromArgb(130, 130, 130)
  1355.     Dim GC6 As Color = Color.FromArgb(120, 120, 120)
  1356.  
  1357.     Dim GC7 As Color = Color.FromArgb(80, 80, 80)
  1358.  
  1359.     Dim PC1 As Color = Color.FromArgb(50, 50, 50)
  1360.     Dim PC2 As Color = Color.FromArgb(83, 83, 83)
  1361.     Dim PC3 As Color = Color.FromArgb(30, 30, 30)
  1362.  
  1363.     Dim FC As Color = Color.FromArgb(124, 195, 255)
  1364.     Dim P As Pen
  1365.     Dim sb As SolidBrush
  1366.     Dim MouseState As State = State.MouseLeft
  1367.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1368.         Using b As New Bitmap(Width, Height)
  1369.             Using g As Graphics = Graphics.FromImage(b)
  1370.                 Dim OuterR As New Rectangle(0, 0, Width - 1, Height - 1)
  1371.                 Dim InnerR As New Rectangle(1, 1, Width - 3, Height - 3)
  1372.                 Dim UpHalf As New Rectangle(0, 0, Width, (Height - 1) / 2)
  1373.                 Dim DownHalf As New Rectangle(0, UpHalf.Height, Width, UpHalf.Height)
  1374.  
  1375.                 Select Case MouseState
  1376.                     Case State.MouseLeft
  1377.                         Draw.Gradient(g, GC1, GC2, UpHalf)
  1378.                         Draw.Gradient(g, GC3, GC2, DownHalf)
  1379.  
  1380.                         P = New Pen(PC1)
  1381.                         g.DrawRectangle(P, OuterR)
  1382.  
  1383.                         P = New Pen(PC2)
  1384.                         g.DrawRectangle(P, InnerR)
  1385.                         ForeColor = FC
  1386.                     Case State.MouseEnter
  1387.                         If alpha < 255 Then
  1388.                             Draw.Gradient(g, GC1, GC2, UpHalf)
  1389.                             Draw.Gradient(g, GC3, GC2, DownHalf)
  1390.                             P = New Pen(PC1)
  1391.                             g.DrawRectangle(P, OuterR)
  1392.                             P = New Pen(PC2)
  1393.                             g.DrawRectangle(P, InnerR)
  1394.                         End If
  1395.  
  1396.                         Draw.Gradient(g, Color.FromArgb(alpha, GC5), Color.FromArgb(alpha, GC6), UpHalf)
  1397.                         Draw.Gradient(g, Color.FromArgb(alpha, GC4), Color.FromArgb(alpha, GC6), DownHalf)
  1398.                         P = New Pen(PC1)
  1399.                         g.DrawRectangle(P, OuterR)
  1400.  
  1401.                         P = New Pen(PC2)
  1402.                         g.DrawRectangle(P, InnerR)
  1403.                         ForeColor = Color.FromArgb(23, 32, 37)
  1404.  
  1405.                     Case State.MouseDown
  1406.  
  1407.                         Console.WriteLine(alpha)
  1408.                         sb = New SolidBrush(GC4)
  1409.  
  1410.                         g.FillRectangle(sb, New Rectangle(0, 0, Width, Height))
  1411.                         Draw.Gradient(g, GC5, GC6, UpHalf)
  1412.                         DownHalf = New Rectangle(0, UpHalf.Height, Width, UpHalf.Height - 1)
  1413.                         Draw.Gradient(g, GC4, GC6, DownHalf)
  1414.                         Draw.Gradient(g, Color.FromArgb(alpha, GC6), Color.FromArgb(alpha, PC2), DownHalf)
  1415.  
  1416.  
  1417.                         P = New Pen(PC1)
  1418.                         g.DrawRectangle(P, OuterR)
  1419.  
  1420.                         P = New Pen(PC2)
  1421.                         g.DrawRectangle(P, InnerR)
  1422.                         ForeColor = Color.FromArgb(23, 32, 37)
  1423.                 End Select
  1424.                 Dim S As SizeF = g.MeasureString(Text, Font)
  1425.                 g.DrawString(Text, Font, New SolidBrush(ForeColor), CInt(Width \ 2 - S.Width \ 2), CInt(Height \ 2 - S.Height \ 2))
  1426.  
  1427.                 e.Graphics.DrawImage(b.Clone, 0, 0)
  1428.             End Using
  1429.         End Using
  1430.         MyBase.OnPaint(e)
  1431.     End Sub
  1432.  
  1433.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  1434.     End Sub
  1435. End Class
Add Comment
Please, Sign In to add comment