Advertisement
Guest User

Recon Theme [Free] - UnReLaTeDScript

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