Advertisement
Guest User

[Dark, Lime] HackerTheme

a guest
Aug 23rd, 2015
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 32.13 KB | None | 0 0
  1. Imports System.Drawing.Drawing2D
  2. Imports System.ComponentModel
  3. Imports System.Runtime.InteropServices
  4.  
  5. MustInherit Class Theme
  6.     Inherits ContainerControl
  7.  
  8. #Region " Initialization "
  9.  
  10.     Protected G As Graphics
  11.     Sub New()
  12.         SetStyle(DirectCast(139270, ControlStyles), True)
  13.     End Sub
  14.  
  15.     Private ParentIsForm As Boolean
  16.     Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  17.         Dock = DockStyle.Fill
  18.         ParentIsForm = TypeOf Parent Is Form
  19.         If ParentIsForm Then
  20.             If Not _TransparencyKey = Color.Empty Then ParentForm.TransparencyKey = _TransparencyKey
  21.             ParentForm.FormBorderStyle = FormBorderStyle.None
  22.         End If
  23.         MyBase.OnHandleCreated(e)
  24.     End Sub
  25.  
  26.     Overrides Property Text() As String
  27.         Get
  28.             Return MyBase.Text
  29.         End Get
  30.         Set(ByVal v As String)
  31.             MyBase.Text = v
  32.             Invalidate()
  33.         End Set
  34.     End Property
  35. #End Region
  36.  
  37. #Region " Sizing and Movement "
  38.  
  39.     Private _Resizable As Boolean = True
  40.     Property Resizable() As Boolean
  41.         Get
  42.             Return _Resizable
  43.         End Get
  44.         Set(ByVal value As Boolean)
  45.             _Resizable = value
  46.         End Set
  47.     End Property
  48.  
  49.     Private _MoveHeight As Integer = 24
  50.     Property MoveHeight() As Integer
  51.         Get
  52.             Return _MoveHeight
  53.         End Get
  54.         Set(ByVal v As Integer)
  55.             _MoveHeight = v
  56.             Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  57.         End Set
  58.     End Property
  59.  
  60.     Private Flag As IntPtr
  61.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  62.         If Not e.Button = MouseButtons.Left Then Return
  63.         If ParentIsForm Then If ParentForm.WindowState = FormWindowState.Maximized Then Return
  64.  
  65.         If Header.Contains(e.Location) Then
  66.             Flag = New IntPtr(2)
  67.         ElseIf Current.Position = 0 Or Not _Resizable Then
  68.             Return
  69.         Else
  70.             Flag = New IntPtr(Current.Position)
  71.         End If
  72.  
  73.         Capture = False
  74.         DefWndProc(Message.Create(Parent.Handle, 161, Flag, Nothing))
  75.  
  76.         MyBase.OnMouseDown(e)
  77.     End Sub
  78.  
  79.     Private Structure Pointer
  80.         ReadOnly Cursor As Cursor, Position As Byte
  81.         Sub New(ByVal c As Cursor, ByVal p As Byte)
  82.             Cursor = c
  83.             Position = p
  84.         End Sub
  85.     End Structure
  86.  
  87.     Private F1, F2, F3, F4 As Boolean, PTC As Point
  88.     Private Function GetPointer() As Pointer
  89.         PTC = PointToClient(MousePosition)
  90.         F1 = PTC.X < 7
  91.         F2 = PTC.X > Width - 7
  92.         F3 = PTC.Y < 7
  93.         F4 = PTC.Y > Height - 7
  94.  
  95.         If F1 And F3 Then Return New Pointer(Cursors.SizeNWSE, 13)
  96.         If F1 And F4 Then Return New Pointer(Cursors.SizeNESW, 16)
  97.         If F2 And F3 Then Return New Pointer(Cursors.SizeNESW, 14)
  98.         If F2 And F4 Then Return New Pointer(Cursors.SizeNWSE, 17)
  99.         If F1 Then Return New Pointer(Cursors.SizeWE, 10)
  100.         If F2 Then Return New Pointer(Cursors.SizeWE, 11)
  101.         If F3 Then Return New Pointer(Cursors.SizeNS, 12)
  102.         If F4 Then Return New Pointer(Cursors.SizeNS, 15)
  103.         Return New Pointer(Cursors.Default, 0)
  104.     End Function
  105.  
  106.     Private Current, Pending As Pointer
  107.     Private Sub SetCurrent()
  108.         Pending = GetPointer()
  109.         If Current.Position = Pending.Position Then Return
  110.         Current = GetPointer()
  111.         Cursor = Current.Cursor
  112.     End Sub
  113.  
  114.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  115.         If _Resizable Then SetCurrent()
  116.         MyBase.OnMouseMove(e)
  117.     End Sub
  118.  
  119.     Protected Header As Rectangle
  120.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  121.         If Width = 0 OrElse Height = 0 Then Return
  122.         Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  123.         Invalidate()
  124.         MyBase.OnSizeChanged(e)
  125.     End Sub
  126.  
  127. #End Region
  128.  
  129. #Region " Convienence "
  130.  
  131.     MustOverride Sub PaintHook()
  132.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  133.         If Width = 0 OrElse Height = 0 Then Return
  134.         G = e.Graphics
  135.         PaintHook()
  136.     End Sub
  137.  
  138.     Private _TransparencyKey As Color
  139.     Property TransparencyKey() As Color
  140.         Get
  141.             Return _TransparencyKey
  142.         End Get
  143.         Set(ByVal v As Color)
  144.             _TransparencyKey = v
  145.             Invalidate()
  146.         End Set
  147.     End Property
  148.  
  149.     Private _Image As Image
  150.     Property Image() As Image
  151.         Get
  152.             Return _Image
  153.         End Get
  154.         Set(ByVal value As Image)
  155.             _Image = value
  156.             Invalidate()
  157.         End Set
  158.     End Property
  159.     ReadOnly Property ImageWidth() As Integer
  160.         Get
  161.             If _Image Is Nothing Then Return 0
  162.             Return _Image.Width
  163.         End Get
  164.     End Property
  165.  
  166.     Private _Size As Size
  167.     Private _Rectangle As Rectangle
  168.     Private _Gradient As LinearGradientBrush
  169.     Private _Brush As SolidBrush
  170.  
  171.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  172.         _Brush = New SolidBrush(c)
  173.         G.FillRectangle(_Brush, rect.X, rect.Y, 1, 1)
  174.         G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y, 1, 1)
  175.         G.FillRectangle(_Brush, rect.X, rect.Y + (rect.Height - 1), 1, 1)
  176.         G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), 1, 1)
  177.     End Sub
  178.  
  179.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  180.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  181.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  182.     End Sub
  183.  
  184.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  185.         DrawText(a, c, x, 0)
  186.     End Sub
  187.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  188.         If String.IsNullOrEmpty(Text) Then Return
  189.         _Size = G.MeasureString(Text, Font).ToSize
  190.         _Brush = New SolidBrush(c)
  191.  
  192.         Select Case a
  193.             Case HorizontalAlignment.Left
  194.                 G.DrawString(Text, Font, _Brush, x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  195.             Case HorizontalAlignment.Right
  196.                 G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  197.             Case HorizontalAlignment.Center
  198.                 G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  199.         End Select
  200.     End Sub
  201.  
  202.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  203.         DrawIcon(a, x, 0)
  204.     End Sub
  205.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  206.         If _Image Is Nothing Then Return
  207.         Select Case a
  208.             Case HorizontalAlignment.Left
  209.                 G.DrawImage(_Image, x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  210.             Case HorizontalAlignment.Right
  211.                 G.DrawImage(_Image, Width - _Image.Width - x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  212.             Case HorizontalAlignment.Center
  213.                 G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, _MoveHeight \ 2 - _Image.Height \ 2)
  214.         End Select
  215.     End Sub
  216.  
  217.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  218.         _Rectangle = New Rectangle(x, y, width, height)
  219.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  220.         G.FillRectangle(_Gradient, _Rectangle)
  221.     End Sub
  222.  
  223. #End Region
  224.  
  225. End Class
  226. MustInherit Class ThemeControl
  227.     Inherits Control
  228.  
  229. #Region " Initialization "
  230.  
  231.     Protected G As Graphics, B As Bitmap
  232.     Sub New()
  233.         SetStyle(DirectCast(139270, ControlStyles), True)
  234.         B = New Bitmap(1, 1)
  235.         G = Graphics.FromImage(B)
  236.     End Sub
  237.  
  238.     Sub AllowTransparent()
  239.         SetStyle(ControlStyles.Opaque, False)
  240.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  241.     End Sub
  242.  
  243.     Overrides Property Text() As String
  244.         Get
  245.             Return MyBase.Text
  246.         End Get
  247.         Set(ByVal v As String)
  248.             MyBase.Text = v
  249.             Invalidate()
  250.         End Set
  251.     End Property
  252. #End Region
  253.  
  254. #Region " Mouse Handling "
  255.  
  256.     Protected Enum State As Byte
  257.         MouseNone = 0
  258.         MouseOver = 1
  259.         MouseDown = 2
  260.     End Enum
  261.  
  262.     Protected MouseState As State
  263.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  264.         ChangeMouseState(State.MouseNone)
  265.         MyBase.OnMouseLeave(e)
  266.     End Sub
  267.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  268.         ChangeMouseState(State.MouseOver)
  269.         MyBase.OnMouseEnter(e)
  270.     End Sub
  271.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  272.         ChangeMouseState(State.MouseOver)
  273.         MyBase.OnMouseUp(e)
  274.     End Sub
  275.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  276.         If e.Button = MouseButtons.Left Then ChangeMouseState(State.MouseDown)
  277.         MyBase.OnMouseDown(e)
  278.     End Sub
  279.  
  280.     Private Sub ChangeMouseState(ByVal e As State)
  281.         MouseState = e
  282.         Invalidate()
  283.     End Sub
  284.  
  285. #End Region
  286.  
  287. #Region " Convienence "
  288.  
  289.     MustOverride Sub PaintHook()
  290.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  291.         If Width = 0 OrElse Height = 0 Then Return
  292.         PaintHook()
  293.         e.Graphics.DrawImage(B, 0, 0)
  294.     End Sub
  295.  
  296.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  297.         If Not Width = 0 AndAlso Not Height = 0 Then
  298.             B = New Bitmap(Width, Height)
  299.             G = Graphics.FromImage(B)
  300.             Invalidate()
  301.         End If
  302.         MyBase.OnSizeChanged(e)
  303.     End Sub
  304.  
  305.     Private _NoRounding As Boolean
  306.     Property NoRounding() As Boolean
  307.         Get
  308.             Return _NoRounding
  309.         End Get
  310.         Set(ByVal v As Boolean)
  311.             _NoRounding = v
  312.             Invalidate()
  313.         End Set
  314.     End Property
  315.  
  316.     Private _Image As Image
  317.     Property Image() As Image
  318.         Get
  319.             Return _Image
  320.         End Get
  321.         Set(ByVal value As Image)
  322.             _Image = value
  323.             Invalidate()
  324.         End Set
  325.     End Property
  326.     ReadOnly Property ImageWidth() As Integer
  327.         Get
  328.             If _Image Is Nothing Then Return 0
  329.             Return _Image.Width
  330.         End Get
  331.     End Property
  332.     ReadOnly Property ImageTop() As Integer
  333.         Get
  334.             If _Image Is Nothing Then Return 0
  335.             Return Height \ 2 - _Image.Height \ 2
  336.         End Get
  337.     End Property
  338.  
  339.     Private _Size As Size
  340.     Private _Rectangle As Rectangle
  341.     Private _Gradient As LinearGradientBrush
  342.     Private _Brush As SolidBrush
  343.  
  344.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  345.         If _NoRounding Then Return
  346.  
  347.         B.SetPixel(rect.X, rect.Y, c)
  348.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  349.         B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  350.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  351.     End Sub
  352.  
  353.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  354.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  355.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  356.     End Sub
  357.  
  358.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  359.         DrawText(a, c, x, 0)
  360.     End Sub
  361.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  362.         If String.IsNullOrEmpty(Text) Then Return
  363.         _Size = G.MeasureString(Text, Font).ToSize
  364.         _Brush = New SolidBrush(c)
  365.  
  366.         Select Case a
  367.             Case HorizontalAlignment.Left
  368.                 G.DrawString(Text, Font, _Brush, x, Height \ 2 - _Size.Height \ 2 + y)
  369.             Case HorizontalAlignment.Right
  370.                 G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, Height \ 2 - _Size.Height \ 2 + y)
  371.             Case HorizontalAlignment.Center
  372.                 G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, Height \ 2 - _Size.Height \ 2 + y)
  373.         End Select
  374.     End Sub
  375.  
  376.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  377.         DrawIcon(a, x, 0)
  378.     End Sub
  379.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  380.         If _Image Is Nothing Then Return
  381.         Select Case a
  382.             Case HorizontalAlignment.Left
  383.                 G.DrawImage(_Image, x, Height \ 2 - _Image.Height \ 2 + y)
  384.             Case HorizontalAlignment.Right
  385.                 G.DrawImage(_Image, Width - _Image.Width - x, Height \ 2 - _Image.Height \ 2 + y)
  386.             Case HorizontalAlignment.Center
  387.                 G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, Height \ 2 - _Image.Height \ 2)
  388.         End Select
  389.     End Sub
  390.  
  391.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  392.         _Rectangle = New Rectangle(x, y, width, height)
  393.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  394.         G.FillRectangle(_Gradient, _Rectangle)
  395.     End Sub
  396. #End Region
  397.  
  398. End Class
  399. MustInherit Class ThemeContainerControl
  400.     Inherits ContainerControl
  401.  
  402. #Region " Initialization "
  403.  
  404.     Protected G As Graphics, B As Bitmap
  405.     Sub New()
  406.         SetStyle(DirectCast(139270, ControlStyles), True)
  407.         B = New Bitmap(1, 1)
  408.         G = Graphics.FromImage(B)
  409.     End Sub
  410.  
  411.     Sub AllowTransparent()
  412.         SetStyle(ControlStyles.Opaque, False)
  413.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  414.     End Sub
  415.  
  416. #End Region
  417. #Region " Convienence "
  418.  
  419.     MustOverride Sub PaintHook()
  420.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  421.         If Width = 0 OrElse Height = 0 Then Return
  422.         PaintHook()
  423.         e.Graphics.DrawImage(B, 0, 0)
  424.     End Sub
  425.  
  426.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  427.         If Not Width = 0 AndAlso Not Height = 0 Then
  428.             B = New Bitmap(Width, Height)
  429.             G = Graphics.FromImage(B)
  430.             Invalidate()
  431.         End If
  432.         MyBase.OnSizeChanged(e)
  433.     End Sub
  434.  
  435.     Private _NoRounding As Boolean
  436.     Property NoRounding() As Boolean
  437.         Get
  438.             Return _NoRounding
  439.         End Get
  440.         Set(ByVal v As Boolean)
  441.             _NoRounding = v
  442.             Invalidate()
  443.         End Set
  444.     End Property
  445.  
  446.     Private _Rectangle As Rectangle
  447.     Private _Gradient As LinearGradientBrush
  448.  
  449.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  450.         If _NoRounding Then Return
  451.         B.SetPixel(rect.X, rect.Y, c)
  452.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  453.         B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  454.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  455.     End Sub
  456.  
  457.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  458.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  459.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  460.     End Sub
  461.  
  462.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  463.         _Rectangle = New Rectangle(x, y, width, height)
  464.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  465.         G.FillRectangle(_Gradient, _Rectangle)
  466.     End Sub
  467. #End Region
  468.  
  469. End Class
  470.  
  471.  
  472.  
  473. Class HackerForm
  474.     Inherits Theme
  475.     Private _ShowIcon As Boolean
  476.     Private TA As TextAlign
  477.     Enum TextAlign As Integer
  478.         Left = 0
  479.         Center = 1
  480.         Right = 2
  481.     End Enum
  482.     Public Property TextAlignment() As TextAlign
  483.         Get
  484.             Return TA
  485.         End Get
  486.         Set(ByVal value As TextAlign)
  487.             TA = value
  488.             Invalidate()
  489.         End Set
  490.     End Property
  491.     Public Property ShowIcon As Boolean
  492.         Get
  493.             Return _ShowIcon
  494.         End Get
  495.         Set(ByVal value As Boolean)
  496.             _ShowIcon = value
  497.             Invalidate()
  498.         End Set
  499.     End Property
  500.     Sub New()
  501.         Color.FromArgb(45, 45, 45)
  502.         MoveHeight = 30
  503.         Me.ForeColor = Color.Lime
  504.         TransparencyKey = Color.Fuchsia
  505.         Me.BackColor = Color.FromArgb(41, 41, 41)
  506.     End Sub
  507.     Overrides Sub PaintHook()
  508.         G.Clear(Color.FromArgb(41, 41, 41))
  509.         DrawGradient(Color.FromArgb(0, 100, 0), Color.FromArgb(0, 30, 0), 1, 1, ClientRectangle.Width, ClientRectangle.Height, 270S)
  510.         DrawBorders(Pens.Black, New Pen(Color.Lime), ClientRectangle)
  511.         DrawGradient(Color.FromArgb(42, 42, 42), Color.FromArgb(40, 40, 40), 5, 30, Width - 10, Height - 35, 90S)
  512.         G.DrawRectangle(New Pen(Color.Lime), 5, 30, Width - 10, Height - 35)
  513.  
  514.         'Icon
  515.         If _ShowIcon = False Then
  516.  
  517.             Select Case TA
  518.                 Case 0
  519.                     DrawText(HorizontalAlignment.Left, Me.ForeColor, 6)
  520.                 Case 1
  521.                     DrawText(HorizontalAlignment.Center, Me.ForeColor, 0)
  522.                 Case 2
  523.                     MsgBox("Invalid Alignment, will not show text.")
  524.             End Select
  525.         Else
  526.  
  527.             Select Case TA
  528.                 Case 0
  529.                     DrawText(HorizontalAlignment.Left, Me.ForeColor, 35)
  530.                 Case 1
  531.                     DrawText(HorizontalAlignment.Center, Me.ForeColor, 0)
  532.                 Case 2
  533.                     MsgBox("Invalid Alignment, will not show text.")
  534.             End Select
  535.             G.DrawIcon(Me.ParentForm.Icon, New Rectangle(New Point(6, 2), New Size(29, 29)))
  536.         End If
  537.  
  538.         DrawCorners(Color.Fuchsia, ClientRectangle)
  539.     End Sub
  540. End Class
  541.  
  542. Class HackerButton
  543.     Inherits ThemeControl
  544.     Sub New()
  545.         Me.ForeColor = Color.Lime
  546.     End Sub
  547.     Overrides Sub PaintHook()
  548.         Select Case MouseState
  549.             Case State.MouseNone
  550.                 G.Clear(Color.FromArgb(49, 49, 49))
  551.                 DrawGradient(Color.FromArgb(22, 22, 22), Color.FromArgb(34, 34, 34), 1, 1, ClientRectangle.Width, ClientRectangle.Height, 270S)
  552.                 DrawBorders(Pens.Lime, New Pen(Color.FromArgb(52, 52, 52)), ClientRectangle)
  553.                 DrawText(HorizontalAlignment.Center, Me.ForeColor, 0)
  554.                 DrawCorners(Me.BackColor, ClientRectangle)
  555.             Case State.MouseDown
  556.                 G.Clear(Color.FromArgb(49, 49, 49))
  557.                 DrawGradient(Color.FromArgb(28, 28, 28), Color.FromArgb(38, 38, 38), 1, 1, ClientRectangle.Width, ClientRectangle.Height, 270S)
  558.                 DrawGradient(Color.FromArgb(100, 0, 0, 0), Color.Transparent, 1, 1, ClientRectangle.Width, ClientRectangle.Height / 2, 90S)
  559.                 DrawBorders(Pens.Lime, New Pen(Color.FromArgb(52, 52, 52)), ClientRectangle)
  560.                 DrawText(HorizontalAlignment.Center, Me.ForeColor, 1)
  561.                 DrawCorners(Me.BackColor, ClientRectangle)
  562.             Case State.MouseOver
  563.                 G.Clear(Color.FromArgb(49, 49, 49))
  564.                 DrawGradient(Color.FromArgb(28, 28, 28), Color.FromArgb(38, 38, 38), 1, 1, ClientRectangle.Width, ClientRectangle.Height, 270S)
  565.                 DrawGradient(Color.FromArgb(100, 50, 50, 50), Color.Transparent, 1, 1, ClientRectangle.Width, ClientRectangle.Height / 2, 90S)
  566.                 DrawBorders(Pens.Lime, New Pen(Color.FromArgb(52, 52, 52)), ClientRectangle)
  567.                 DrawText(HorizontalAlignment.Center, Me.ForeColor, 0)
  568.                 DrawCorners(Me.BackColor, ClientRectangle)
  569.         End Select
  570.         Me.Cursor = Cursors.Hand
  571.  
  572.     End Sub
  573. End Class
  574.  
  575. Class HackerTextBox
  576.     Inherits TextBox
  577.  
  578.     Protected Overrides Sub WndProc(ByRef m As Message)
  579.         Select Case m.Msg
  580.             Case 15
  581.                 Invalidate()
  582.                 MyBase.WndProc(m)
  583.                 Me.CustomPaint()
  584.                 Exit Select
  585.             Case Else
  586.                 MyBase.WndProc(m)
  587.                 Exit Select
  588.         End Select
  589.     End Sub
  590.  
  591.     Sub New()
  592.         Font = New Font("Microsoft Sans Serif", 8)
  593.         ForeColor = Color.Lime
  594.         BackColor = Color.FromArgb(28, 28, 28)
  595.         BorderStyle = Windows.Forms.BorderStyle.FixedSingle
  596.     End Sub
  597.  
  598.     Private Sub CustomPaint()
  599.         Dim p As New Pen(Color.Lime)
  600.         Dim o As New Pen(Color.FromArgb(45, 45, 45))
  601.         CreateGraphics.DrawLine(p, 0, 0, Width, 0)
  602.         CreateGraphics.DrawLine(p, 0, Height - 1, Width, Height - 1)
  603.         CreateGraphics.DrawLine(p, 0, 0, 0, Height - 1)
  604.         CreateGraphics.DrawLine(p, Width - 1, 0, Width - 1, Height - 1)
  605.  
  606.         CreateGraphics.DrawLine(o, 1, 1, Width - 2, 1)
  607.         CreateGraphics.DrawLine(o, 1, Height - 2, Width - 2, Height - 2)
  608.         CreateGraphics.DrawLine(o, 1, 1, 1, Height - 2)
  609.         CreateGraphics.DrawLine(o, Width - 2, 1, Width - 2, Height - 2)
  610.     End Sub
  611. End Class
  612.  
  613. Class HackerBar
  614.     Inherits ThemeControl
  615.  
  616.     Private _Value As Integer = 0
  617.  
  618.     Public Property Value() As Integer
  619.         Get
  620.             Return _Value
  621.         End Get
  622.         Set(value As Integer)
  623.             If value > 100 Then
  624.                 value = 100
  625.             End If
  626.             If value < 0 Then
  627.                 value = 0
  628.             End If
  629.             _Value = value
  630.             Invalidate()
  631.         End Set
  632.     End Property
  633.  
  634.     Public Sub Increment()
  635.         If _Value = 100 Then
  636.             _Value = 99
  637.         End If
  638.         _Value = _Value + 1
  639.         Invalidate()
  640.     End Sub
  641.  
  642.     Public Overrides Sub PaintHook()
  643.         G.Clear(Me.BackColor)
  644.  
  645.         DrawGradient(Color.Lime, Color.Green, 0, 0, Width, Height, 270S)
  646.         DrawGradient(Color.FromArgb(20, 20, 20), Color.FromArgb(50, 50, 50), 1, 1, Width - 2, Height - 2, 270S)
  647.  
  648.         If Not _Value = 0 Then
  649.             DrawGradient(Color.Lime, Color.Green, 0, 0, (Width / 100) * _Value, Height, 180S)
  650.         End If
  651.  
  652.     End Sub
  653. End Class
  654.  
  655. Class HackerGroupBox
  656.     Inherits ThemeContainerControl
  657.     Sub New()
  658.         AllowTransparent()
  659.     End Sub
  660.     Overrides Sub PaintHook()
  661.         G.Clear(Color.FromArgb(25, 25, 25))
  662.         Me.BackColor = Color.FromArgb(25, 25, 25)
  663.         DrawGradient(Color.FromArgb(11, 11, 11), Color.FromArgb(26, 26, 26), 1, 1, ClientRectangle.Width, ClientRectangle.Height, 270S)
  664.         DrawBorders(Pens.Black, New Pen(Color.FromArgb(52, 52, 52)), ClientRectangle)
  665.  
  666.         DrawGradient(Color.FromArgb(150, 32, 32, 32), Color.FromArgb(150, 31, 31, 31), 5, 23, Width - 10, Height - 28, 90S)
  667.         G.DrawRectangle(New Pen(Color.FromArgb(130, 13, 13, 13)), 5, 23, Width - 10, Height - 28)
  668.  
  669.         G.DrawString(Text, Font, New SolidBrush(Me.ForeColor), 4, 6)
  670.  
  671.         DrawCorners(Color.Transparent, ClientRectangle)
  672.     End Sub
  673. End Class
  674.  
  675. Class HackerCheck
  676.     Inherits ThemeControl
  677.  
  678. #Region " Properties "
  679.     Private _CheckedState As Boolean
  680.     Public Property CheckedState() As Boolean
  681.         Get
  682.             Return _CheckedState
  683.         End Get
  684.         Set(ByVal v As Boolean)
  685.             _CheckedState = v
  686.             Invalidate()
  687.         End Set
  688.     End Property
  689. #End Region
  690.  
  691.     Sub New()
  692.         Size = New Size(90, 15)
  693.         MinimumSize = New Size(16, 16)
  694.         MaximumSize = New Size(600, 16)
  695.         CheckedState = False
  696.     End Sub
  697.  
  698.     Public Overrides Sub PaintHook()
  699.         G.Clear(BackColor)
  700.         DrawGradient(Color.FromArgb(18, 18, 18), Color.FromArgb(28, 28, 28), 0, 0, 15, 15, 90S)
  701.  
  702.         Select Case CheckedState
  703.             Case True
  704.  
  705.                 DrawGradient(Color.FromArgb(18, 18, 18), Color.FromArgb(28, 28, 28), 0, 0, 15, 15, 270S)
  706.                 DrawGradient(Color.FromArgb(100, 40, 40, 40), Color.Transparent, 0, 0, 15, 15, 90S)
  707.  
  708.                 DrawGradient(Color.FromArgb(5, Me.ForeColor), Color.Transparent, 0, 0, 15, 15, 90S)
  709.                 DrawGradient(Color.FromArgb(9, Me.ForeColor), Color.Transparent, 0, 0, 15, 15, 270S)
  710.  
  711.                 G.DrawRectangle(New Pen(Color.Lime), 3, 3, 11, 11)
  712.                 DrawGradient(Color.FromArgb(50, 50, 50), Color.FromArgb(30, 30, 30), 0, 0, 15, 15, 90S)
  713.         End Select
  714.  
  715.         DrawBorders(Pens.Lime, New Pen(Color.FromArgb(52, 52, 52)), New Rectangle(0, 0, 15, 15))
  716.         DrawText(HorizontalAlignment.Left, Me.ForeColor, 17, 0)
  717.     End Sub
  718.  
  719.     Sub changeCheck() Handles Me.MouseDown
  720.         Select Case CheckedState
  721.             Case True
  722.                 CheckedState = False
  723.             Case False
  724.                 CheckedState = True
  725.         End Select
  726.     End Sub
  727. End Class
  728.  
  729. Class HackerCheckBox
  730.     Inherits ThemeControl
  731.  
  732. #Region " Properties "
  733.     Private _CheckedState As Boolean
  734.     Public Property CheckedState() As Boolean
  735.         Get
  736.             Return _CheckedState
  737.         End Get
  738.         Set(ByVal v As Boolean)
  739.             _CheckedState = v
  740.             Invalidate()
  741.         End Set
  742.     End Property
  743. #End Region
  744.  
  745.     Sub New()
  746.         Size = New Size(90, 15)
  747.         MinimumSize = New Size(16, 16)
  748.         MaximumSize = New Size(600, 16)
  749.         CheckedState = False
  750.     End Sub
  751.  
  752.     Public Overrides Sub PaintHook()
  753.         G.Clear(Me.Parent.BackColor)
  754.         DrawGradient(Color.FromArgb(22, 22, 22), Color.FromArgb(32, 32, 32), 0, 0, 15, 15, 90S)
  755.         Select Case CheckedState
  756.             Case True
  757.                 DrawBorders(Pens.Lime, New Pen(Color.FromArgb(52, 52, 52)), New Rectangle(0, 0, 15, 15))
  758.                 G.DrawString("a", New Font("Marlett", 12), Brushes.Black, New Point(-3, -1))
  759.             Case False
  760.                 DrawBorders(Pens.Lime, New Pen(Color.FromArgb(52, 52, 52)), New Rectangle(0, 0, 15, 15))
  761.         End Select
  762.  
  763.         DrawText(HorizontalAlignment.Left, Me.ForeColor, 17, 0)
  764.     End Sub
  765.  
  766.     Sub changeCheck() Handles Me.MouseDown
  767.         Select Case CheckedState
  768.             Case True
  769.                 CheckedState = False
  770.             Case False
  771.                 CheckedState = True
  772.         End Select
  773.     End Sub
  774. End Class
  775.  
  776. Class HackerSeperator
  777.     Inherits Control
  778.  
  779.     Private _Orientation As Orientation
  780.     Public Property Orientation() As Orientation
  781.         Get
  782.             Return _Orientation
  783.         End Get
  784.         Set(ByVal v As Orientation)
  785.             _Orientation = v
  786.             UpdateOffset()
  787.             Invalidate()
  788.         End Set
  789.     End Property
  790.  
  791.     Dim G As Graphics, B As Bitmap, I As Integer
  792.     Dim C1 As Color, P1, P2 As Pen
  793.     Sub New()
  794.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint, True)
  795.         C1 = Me.BackColor
  796.         P1 = New Pen(Color.FromArgb(22, 22, 22))
  797.         P2 = New Pen(Color.FromArgb(49, 49, 49))
  798.         MinimumSize = New Size(5, 2)
  799.         MaximumSize = New Size(10000, 2)
  800.     End Sub
  801.  
  802.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  803.         UpdateOffset()
  804.         MyBase.OnSizeChanged(e)
  805.     End Sub
  806.  
  807.     Sub UpdateOffset()
  808.         I = Convert.ToInt32(If(_Orientation = 0, Height / 2 - 1, Width / 2 - 1))
  809.     End Sub
  810.  
  811.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  812.         B = New Bitmap(Width, Height)
  813.         G = Graphics.FromImage(B)
  814.  
  815.         G.Clear(C1)
  816.  
  817.         If _Orientation = 0 Then
  818.             G.DrawLine(P1, 0, I, Width, I)
  819.             G.DrawLine(P2, 0, I + 1, Width, I + 1)
  820.         Else
  821.             G.DrawLine(P2, I, 0, I, Height)
  822.             G.DrawLine(P1, I + 1, 0, I + 1, Height)
  823.         End If
  824.  
  825.         e.Graphics.DrawImage(B, 0, 0)
  826.         G.Dispose()
  827.         B.Dispose()
  828.     End Sub
  829.  
  830.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  831.     End Sub
  832.  
  833. End Class
  834.  
  835. Class HackerClose
  836.     Inherits ThemeControl
  837.  
  838.     Sub New()
  839.         Size = New Size(29, 23)
  840.         Location = New Point(Width - 32, 3)
  841.     End Sub
  842.  
  843.     Private Sub Close_Form() Handles Me.Click
  844.         Me.FindForm().Close()
  845.     End Sub
  846.  
  847.     Public Overrides Sub PaintHook()
  848.         G.Clear(Me.BackColor)
  849.         Select Case MouseState
  850.             Case State.MouseNone
  851.                 G.Clear(Color.FromArgb(49, 49, 49))
  852.                 DrawGradient(Color.FromArgb(22, 22, 22), Color.FromArgb(34, 34, 34), 1, 1, ClientRectangle.Width, ClientRectangle.Height, 270S)
  853.                 DrawBorders(Pens.Lime, New Pen(Color.FromArgb(52, 52, 52)), ClientRectangle)
  854.                 G.DrawString("X", New Font("Microsoft Sans Serif", 12), New SolidBrush(Me.ForeColor), New Point(5, 2))
  855.                 DrawCorners(Me.BackColor, ClientRectangle)
  856.             Case State.MouseOver
  857.                 G.Clear(Color.FromArgb(49, 49, 49))
  858.                 DrawGradient(Color.FromArgb(28, 28, 28), Color.FromArgb(38, 38, 38), 1, 1, ClientRectangle.Width, ClientRectangle.Height, 270S)
  859.                 DrawGradient(Color.FromArgb(100, 0, 0, 0), Color.Transparent, 1, 1, ClientRectangle.Width, ClientRectangle.Height / 2, 90S)
  860.                 DrawBorders(Pens.Lime, New Pen(Color.FromArgb(52, 52, 52)), ClientRectangle)
  861.                 G.DrawString("X", New Font("Microsoft Sans Serif", 12), New SolidBrush(Me.ForeColor), New Point(5, 2))
  862.                 DrawCorners(Me.BackColor, ClientRectangle)
  863.             Case State.MouseDown
  864.                 G.Clear(Color.FromArgb(49, 49, 49))
  865.                 DrawGradient(Color.FromArgb(28, 28, 28), Color.FromArgb(38, 38, 38), 1, 1, ClientRectangle.Width, ClientRectangle.Height, 270S)
  866.                 DrawGradient(Color.FromArgb(100, 50, 50, 50), Color.Transparent, 1, 1, ClientRectangle.Width, ClientRectangle.Height / 2, 90S)
  867.                 DrawBorders(Pens.Lime, New Pen(Color.FromArgb(52, 52, 52)), ClientRectangle)
  868.                 G.DrawString("X", New Font("Microsoft Sans Serif", 12), New SolidBrush(Me.ForeColor), New Point(5, 2))
  869.                 DrawCorners(Me.BackColor, ClientRectangle)
  870.         End Select
  871.         Me.Cursor = Cursors.Hand
  872.     End Sub
  873. End Class
  874.  
  875. Class HackerMinize
  876.     Inherits ThemeControl
  877.  
  878.     Sub New()
  879.         Size = New Size(29, 23)
  880.         Location = New Point(Width - 32, 3)
  881.     End Sub
  882.  
  883.     Private Sub Close_Form() Handles Me.Click
  884.         Me.FindForm().WindowState = FormWindowState.Minimized
  885.     End Sub
  886.  
  887.     Public Overrides Sub PaintHook()
  888.         G.Clear(Me.BackColor)
  889.         Select Case MouseState
  890.             Case State.MouseNone
  891.                 G.Clear(Color.FromArgb(49, 49, 49))
  892.                 DrawGradient(Color.FromArgb(22, 22, 22), Color.FromArgb(34, 34, 34), 1, 1, ClientRectangle.Width, ClientRectangle.Height, 270S)
  893.                 DrawBorders(Pens.Lime, New Pen(Color.FromArgb(52, 52, 52)), ClientRectangle)
  894.                 G.DrawString("_", New Font("Microsoft Sans Serif", 12), New SolidBrush(Me.ForeColor), New Point(7, 0))
  895.                 DrawCorners(Me.BackColor, ClientRectangle)
  896.             Case State.MouseOver
  897.                 G.Clear(Color.FromArgb(49, 49, 49))
  898.                 DrawGradient(Color.FromArgb(28, 28, 28), Color.FromArgb(38, 38, 38), 1, 1, ClientRectangle.Width, ClientRectangle.Height, 270S)
  899.                 DrawGradient(Color.FromArgb(100, 0, 0, 0), Color.Transparent, 1, 1, ClientRectangle.Width, ClientRectangle.Height / 2, 90S)
  900.                 DrawBorders(Pens.Lime, New Pen(Color.FromArgb(52, 52, 52)), ClientRectangle)
  901.                 G.DrawString("_", New Font("Microsoft Sans Serif", 12), New SolidBrush(Me.ForeColor), New Point(7, 0))
  902.                 DrawCorners(Me.BackColor, ClientRectangle)
  903.             Case State.MouseDown
  904.                 G.Clear(Color.FromArgb(49, 49, 49))
  905.                 DrawGradient(Color.FromArgb(28, 28, 28), Color.FromArgb(38, 38, 38), 1, 1, ClientRectangle.Width, ClientRectangle.Height, 270S)
  906.                 DrawGradient(Color.FromArgb(100, 50, 50, 50), Color.Transparent, 1, 1, ClientRectangle.Width, ClientRectangle.Height / 2, 90S)
  907.                 DrawBorders(Pens.Lime, New Pen(Color.FromArgb(52, 52, 52)), ClientRectangle)
  908.                 G.DrawString("_", New Font("Microsoft Sans Serif", 12), New SolidBrush(Me.ForeColor), New Point(7, 0))
  909.                 DrawCorners(Me.BackColor, ClientRectangle)
  910.         End Select
  911.         Me.Cursor = Cursors.Hand
  912.     End Sub
  913. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement